generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: TextBoxes

Previous Thread :: Next Thread 
kingkiller1000 is not online. kingkiller1000
Joined: 12 Dec 2008
Total Posts: 26415
25 Feb 2012 03:35 PM
When you click anywhere except on a TextBox, the text in the TextBox clears. How do I fix this?

I also have an event connecting to when the text is changed, so I can't mess with that.
Report Abuse
tehepicford is not online. tehepicford
Joined: 26 Aug 2011
Total Posts: 1486
25 Feb 2012 03:41 PM
Use TextLabel
Report Abuse
kingkiller1000 is not online. kingkiller1000
Joined: 12 Dec 2008
Total Posts: 26415
25 Feb 2012 03:41 PM
But I want them to be able to TYPE in it...
Report Abuse
tehepicford is not online. tehepicford
Joined: 26 Aug 2011
Total Posts: 1486
25 Feb 2012 03:42 PM
Oh. Make it change to a TextBox when ready?
Report Abuse
TINISH0TZ is not online. TINISH0TZ
Joined: 20 Nov 2009
Total Posts: 2549
25 Feb 2012 03:43 PM
Is the actual text a 'line of text' object?
Report Abuse
SDuke524 is not online. SDuke524
Joined: 29 Jul 2008
Total Posts: 6267
25 Feb 2012 03:44 PM
Save the text as a variable elsewhere, if the text becomes null, set it back to what it was before.
Report Abuse
kingkiller1000 is not online. kingkiller1000
Joined: 12 Dec 2008
Total Posts: 26415
25 Feb 2012 03:44 PM
'line of text' object? What are you talking about?
Report Abuse
tehepicford is not online. tehepicford
Joined: 26 Aug 2011
Total Posts: 1486
25 Feb 2012 03:44 PM
What he wants is

A text Box witch basically he can't edit by mistake. But others can when ready.
Report Abuse
TINISH0TZ is not online. TINISH0TZ
Joined: 20 Nov 2009
Total Posts: 2549
25 Feb 2012 03:49 PM
This is the same text you have already written inside right?

Same thing happened to me, turns out it was one of those Click_To_Remove texts.
Report Abuse
stravant is not online. stravant
Forum Moderator
Joined: 22 Oct 2007
Total Posts: 2893
25 Feb 2012 03:57 PM
You have to maintain a global table of the contents of all of your TextBoxes and use that in combination with the various events to fix it manually. There is no easy fix.
Report Abuse
SDuke524 is not online. SDuke524
Joined: 29 Jul 2008
Total Posts: 6267
25 Feb 2012 04:01 PM
    function textboxProtection(gui)
        for _,v in pairs(gui:GetChildren()) do
            if v:IsA("TextBox") then
                local text=v.Text;
                v.Changed:connect(function()
                    if v.Text=="" or v.Text:gsub("%s","")=="" then
                        v.Text=text;
                    else
                        text=v.Text;
                end end
                )
            else
                textboxProtection(v);
    end end end
    
    textboxProtection(script.Parent);

I think that should work.
Report Abuse
kingkiller1000 is not online. kingkiller1000
Joined: 12 Dec 2008
Total Posts: 26415
25 Feb 2012 04:06 PM
As I said, I have .Changed connected to a function that checks to make sure the text isn't just an empty string, and if so then change it back. But when I change it back, the .Changed fires again. How would I prevent this?
Report Abuse
SDuke524 is not online. SDuke524
Joined: 29 Jul 2008
Total Posts: 6267
25 Feb 2012 04:11 PM
It'll fire twice but that shouldn't be a problem if you do it right.
Report Abuse
stravant is not online. stravant
Forum Moderator
Joined: 22 Oct 2007
Total Posts: 2893
25 Feb 2012 04:12 PM
Debounce it. Simple as that. Debouncing isn't only for buttons.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image