|
| 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 |
|
|
| |
|
|
| 25 Feb 2012 03:41 PM |
| But I want them to be able to TYPE in it... |
|
|
| Report Abuse |
|
|
|
| 25 Feb 2012 03:42 PM |
| Oh. Make it change to a TextBox when ready? |
|
|
| Report Abuse |
|
|
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
|
  |
| 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 |
|
|
|
| 25 Feb 2012 03:44 PM |
| 'line of text' object? What are you talking about? |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| 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
|
  |
 |
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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
|
  |
 |
| 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 |
|
|