How can I identify a textfield just selected?
BlitzMax Forums/MaxGUI Module/How can I identify a textfield just selected?
| ||
In MAXGui: I know that GadgetLostFocus notifies the leaving of a gadget, but how do I know that the cursor is on a specific textfield, if no changes have been made to the text? |
| ||
Function ActiveGadget:TGadget() Returns The gadget if any that currently has the keyboard focus. Description Return the currently active Gadget. |
| ||
So selecting a textfield doesn't trigger an event!? What I wanted to do works fine now; since I used: Repeat If PollEvent() else if ActiveGadget() endif foreverinstead of: While WaitEvent() WendThanx JSP! |
| ||
Ahhh - wouldn't do that if I were you. Your program's CPU usage will max out your processor. I'd use a timer if I was that stuck but even then, it's hardly ideal... Cardinal rule of application programming: don't check if nothing has changed = don't do something unless an event has happened = always use WaitEvent(). ;-) True, there aren't events (at the moment) which show you this particular thing has changed but even using a timer to check every 100 milliseconds would be better than your current loop which is just wasting billions of CPU cycles. There may be a few tricks up my sleeve with the current development version of MaxGUI I'm testing - I'll let you know more once it's available on SVN, but it should help you out somewhat... Btw, when posting code, use the [code ] or [codebox ] tags - see the following page for more info: What are the forum codes?. I've edited your original post to show you how its done... ;-) |
| ||
I knew it was an "ugly" workaround, but I needed something, so I could test the rest of my code. From your post I take it there is no "clean" solution at the moment. (Until You shake those sleeves) ;) In the meantime I will have to make sure there is always a gadget selected, so I can keep track of the cursor. Let's see how this evolves... |