mu6666mu
|
  |
| Joined: 09 Apr 2012 |
| Total Posts: 952 |
|
|
| 15 Feb 2014 01:04 AM |
| How would I set a script to call a function when the Focus of a TextBox is captured? |
|
|
| Report Abuse |
|
|
wazap
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 23234 |
|
| |
|
Hazania
|
  |
| Joined: 04 Jun 2010 |
| Total Posts: 1344 |
|
|
| 15 Feb 2014 01:15 AM |
| ^ only thing I could find too, there is no FocusFound :( |
|
|
| Report Abuse |
|
|
Hazania
|
  |
| Joined: 04 Jun 2010 |
| Total Posts: 1344 |
|
|
| 15 Feb 2014 01:15 AM |
| You could set a value to true when you capture focus and then on FocusLost set value to false |
|
|
| Report Abuse |
|
|
wazap
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 23234 |
|
|
| 15 Feb 2014 01:16 AM |
"set value to true when focus is captured"
"when focus is captured"
Isnt that the entire point of this question?
@OP try setting the Active property to true and then use .MouseButton1Click event? |
|
|
| Report Abuse |
|
|
|
| 15 Feb 2014 01:18 AM |
I think use MouseButton1Click and set a var to true Then when focus is lost,set it to false :D |
|
|
| Report Abuse |
|
|
|
| 15 Feb 2014 01:19 AM |
| Wazappppp!you beat me again! |
|
|
| Report Abuse |
|
|
Hazania
|
  |
| Joined: 04 Jun 2010 |
| Total Posts: 1344 |
|
|
| 15 Feb 2014 01:21 AM |
@wazap, Yes, it's the solution to his question. He wanted to know how he can have a function activated when it captures focus.
Via a Boolean it's very easily done. And that's what I explained, how that can be said to be exactly what he asked, idk...? You make sense.? :3 lol |
|
|
| Report Abuse |
|
|
|
| 15 Feb 2014 01:23 AM |
He wanted to know HOW to check if focus was captured Not how to set a value when it is,I'm sure he knows that.. |
|
|
| Report Abuse |
|
|
Hazania
|
  |
| Joined: 04 Jun 2010 |
| Total Posts: 1344 |
|
|
| 15 Feb 2014 01:25 AM |
| By setting a value to when it is, he can check if it is. Because if he sets value to false when FocusLost is activated then the value reports the state of the focus. |
|
|
| Report Abuse |
|
|
|
| 15 Feb 2014 01:28 AM |
Thing is,there's no .FoucFound event buddy..clicking on it would have to use MouseButton1Click Set a variable to true FocusLost Set a variable to false.. Otherwise it doesn't KNOW when focus is found.. Ex: Focuslost val = false Now we have a value that is false,and that helps us find out when focus is found? Nopedoing what I said with the mousbutton1 and all that,he could then have like a loop that checks the value,anyways,night(ish) |
|
|
| Report Abuse |
|
|
wazap
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 23234 |
|
|
| 15 Feb 2014 01:29 AM |
| Ok Haz. Now tell me how you would set the variable to true again when the textbox's focus is captured. Because isnt that the entire point of the thread? |
|
|
| Report Abuse |
|
|
|
| 15 Feb 2014 01:31 AM |
| @wazap,exactly,but I don't think this is getting thru to him.. |
|
|
| Report Abuse |
|
|
Hazania
|
  |
| Joined: 04 Jun 2010 |
| Total Posts: 1344 |
|
|
| 15 Feb 2014 01:31 AM |
If you type script.Parent:CaptureFocus() then next line is Bool=true.. simple enuf? night. |
|
|
| Report Abuse |
|
|
|
| 15 Feb 2014 01:32 AM |
That's only if u want it capturefocus by itself.. What if they click on it? |
|
|
| Report Abuse |
|
|
Hazania
|
  |
| Joined: 04 Jun 2010 |
| Total Posts: 1344 |
|
|
| 15 Feb 2014 01:34 AM |
| You realize in a click script you still have to type capturefocus...???? You can set the value from anywhere, even if it requires an exterior value in Lighting my way is still valid. I didn't say it was the best way I just said it was a way. |
|
|
| Report Abuse |
|
|
|
| 15 Feb 2014 01:38 AM |
CaptureFocus() acts like the textbox being clicked on,if u say wait(5) script.Parent:CaptureFocus() It'll allow u to type in it,as if u had clicked it.. U can't say:if script.Parent:CaptureFocus() then.. That doesn't make any sence,I think u must be reallly tired.. |
|
|
| Report Abuse |
|
|
Hazania
|
  |
| Joined: 04 Jun 2010 |
| Total Posts: 1344 |
|
|
| 15 Feb 2014 11:37 AM |
I never said 'if blabla then' I said the next line AFTER then capture focus line, set a value to true. HOW FKING HARD IS THIS TO UNDRSTAND holy shiza man..
CaptureFocus() wait(5) script.Parent:CaptureFocus() ---- here put BoolValue=true then you can use the FocusLost() to set BoolValue to false if it isn't caputurefocus. |
|
|
| Report Abuse |
|
|
|
| 15 Feb 2014 11:43 AM |
when u click on a textbox,it allows u to type in it saying script.Paret:CaptureFocus() will do the same as clicking on it but in order to CHECK when its clicked on,u do:script.Parent.MouseButton1Click.. |
|
|
| Report Abuse |
|
|
Hazania
|
  |
| Joined: 04 Jun 2010 |
| Total Posts: 1344 |
|
|
| 15 Feb 2014 11:45 AM |
| That's why I said my method works, but I never said it was the best method. I never told you that you were wrong, I was simply saying that my method works just fine. You can add BoolValue changes anywhere that clicks or capturefocus's are located in scripts. It's not fkin rocket science. |
|
|
| Report Abuse |
|
|
|
| 15 Feb 2014 12:04 PM |
but..ugh.. theres nothing that says if textbox is focused then var = true else var = false
no such thing,thats why u need mousbutton1click |
|
|
| Report Abuse |
|
|
dodleman
|
  |
| Joined: 22 Dec 2007 |
| Total Posts: 1118 |
|
|
| 15 Feb 2014 12:18 PM |
| Omg. Haz, just jump off a bridge you're not helping. OP is trying to figure out WHEN A TEXTBOX IS CLICKED, not when it loses focus, not forcing a capture, just when it is clicked. Hence mousebutton1click, now get out. |
|
|
| Report Abuse |
|
|
|
| 15 Feb 2014 12:31 PM |
| thx dodle,but I don't think haz gets it..even still.. |
|
|
| Report Abuse |
|
|
Hazania
|
  |
| Joined: 04 Jun 2010 |
| Total Posts: 1344 |
|
|
| 16 Feb 2014 06:58 PM |
Well, you still managed to fail to see my point, but I do agree; I'm not helping the OP so I'll leave this haha..
|
|
|
| Report Abuse |
|
|
Hazania
|
  |
| Joined: 04 Jun 2010 |
| Total Posts: 1344 |
|
|
| 16 Feb 2014 07:02 PM |
| And @island, I get what your saying, but you do t understand what I'm trying to explain. Both of our ways work, yours is more useful in this instance. Sorry for the pointless argument. |
|
|
| Report Abuse |
|
|