SetGadgetFilter doesn't work on textfields
BlitzMax Forums/MaxGUI Module/SetGadgetFilter doesn't work on textfields
| ||
Yet more MaxGUI misery: Works fine if I change the textfield to a textarea, but I want - nay - NEED a textfield! SuperStrict Import maxgui.drivers Global mainWin:TGadget = CreateWindow("Main" , 0 , 0 , 400 , 400) Global ta:TGadget = CreateTextField(10 , 10 , 300 , 300 , mainWin) Global quit:Int = False ActivateGadget ta SetGadgetFilter(ta, keyFilter) While Not quit WaitEvent() Select EventID() Case EVENT_APPTERMINATE, EVENT_WINDOWCLOSE quit = True End Select Wend End Function keyFilter:Int(event:TEvent, context:Object) Select Event.ID Case EVENT_KEYCHAR If event.data = KEY_ENTER Notify "PARP!" EndIf End Select Return True End Function [edit] (code swiped and modified from elsewhere on this forum) [edit] Actually I might get away with a TextArea instead. It'd be nice if this stuff just worked, though! Last edited 2010 |
| ||
I think the problem is not MaxGUI, but the Windows GUI design: tab and enter keys are intercepted by the OS. If you test with FLTK you will see that the program runs as expected (you will intercept the KEY_ENTER event). |
| ||
GfK: If you suspect a bug, it might be best to report it on the official site via the bug tracker, forums or help system (whichever best applies). |
| ||
GfK: If you suspect a bug, it might be best to report it on the official site via the bug tracker, forums or help system (whichever best applies). ...as opposed to the MaxGUI Bug Reports forum which presumably, unless I'm much mistaken, is for posting bug reports pertaining to MaxGUI? |
| ||
...as opposed to the MaxGUI Bug Reports forum which presumably, unless I'm much mistaken, is for posting bug reports pertaining to MaxGUI? I was trying to help. You are forgetting this is a deprecated product and no longer sold or distributed or connected in any way to BRL. With the situation what it is, if you have a legitimate bug report, you should file it on the official site. It certainly wouldn't hurt. |
| ||
With the situation what it is, if you have a legitimate bug report, you should file it on the official site. That's what I thought I'd done. Maybe this forum should be binned if its of no relevance any more. |
| ||
If you want to "filter" only the return key you don't have to use the gagdetfilter, but use the OK Button (and the Cancel Button for filtering ESC). Let me know if you need an example. |
| ||
Unfortunately this is a design shortcoming in windows where the enter key must be wired / shortcutted internally to an OK button for an app to follow the Windows design guidelines correctly. I agree that it would be nice if it "just worked" in MaxGUI but this is one case where it is MaxGUI's documentation that is coming up short not it's implementation. |
| ||
I had read that elsewhere but assumed it was just a 'hack'. My situation is that I want to hit Enter in any number of text fields in a window, and have some information update elsewhere in the form (i.e. I have a "Name" textfield and a listview containing a list of Names, which needs to be refreshed when the Name textfield is validated via the Enter key). It works with a text area but this is only for a game editor for personal use so I guess it doesn't have to be perfect/pretty, as long as it does the job. Thanks for the info. |
| ||
The OK Button is just fine for your problem I think. When the event occurs read in your textfields and act accordingly. You can also check for event GADGETLOSTFOCUS of your textfields, which are triggered when they loose focus e.g. by using tab from one textfield to the other... |