Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

How might I detect when an InputField comes into focus?

For example ideally something like this would work.

EventHandler[
 InputField["default", String], {
  "FocusGained" :> (MessageDialog["Focus"]),
  "FocusLost" :> (MessageDialog["unFocus"]),
  "Focus" :> (MessageDialog["Focus"])
  }
 ]

After reading this question I assumed "FocusGained,FocusLost or Focus" would do something but I haven't had any luck just yet.

share|improve this question
1  
A workaround may be to use "MouseClicked" to trigger "focus" and then use ControllerState["Button 1"] to trigger "unfocus", using "MouseEntered" and "MouseExited" to determine if the click was inside our outside the input box. –  Pickett Aug 25 '13 at 17:57
1  
These are not events for EventHandler but events in GUIKit‌​. –  Michael E2 Aug 26 '13 at 0:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.