|
From: jeroen <je...@fo...> - 2001-12-14 00:52:59
|
On Thursday 13 December 2001 06:08, you wrote: > Hi, > > I have an big problem which I cannot solve. > > I have an FXTextField and catch the SEL_VERIFY to verify > the input to this textfield. When I "return 1" in my own message > handler, it works as espected - the input is not accepted. > When I "return 0" the input is accepted but when I switch > to another widget (by cursor or keyboard) I get an "grab failed" > and the window is killed. My own message handler only has > an return statement (either 0 or 1), nothing else (just to be sure > I did nothing wrong inside this handler). > > Any ideas? > > Thanks for help in advance It all depends on what exactly happens in your program, i.e. what the callback which gets the SEL_COMMAND from the FXTextField is trying to do. TEXTFIELD_ENTER_ONLY is a flag which causes FXTextField to emit a SEL_COMMAND message only when the RETURN-key is hit inside the text field. If this flag is NOT specified, the FXTextField may try to emit SEL_COMMAND also when it has been modified and looses the focus (due to some other widget getting the focus). This means that the GUI may try to do one thing, in response to the FXTextField's SEL_COMMAND, while it is already committed to another GUI action (for example a button which has stolen the focus from FXTextField). The FXButton wants to grab the mouse, but the callback invoked via the FXTextField's SEL_COMMAND has already grabbed the mouse too. Therefore the FXButton will fail to grab the mouse. If it were purely up to me, FXTextField would not send a SEL_COMMAND at all when loosing focus, but it is damn convenient as you enter-and-tab around so I compromised and added this TEXTFIELD_ENTER_ONLY flag for those (few) cases where it causes a problem Hope this helps, Jeroen |