[Gambas-user] Focus Events on DataControls

Benoit Minisini gambas at ...1...
Tue Feb 19 18:35:32 CET 2008


On samedi 16 février 2008, Nx GT-R BOY wrote:
>  Hi everybody, (Hope this wont be junk but.. happy valentine's day)
>
> Is there a way to know when a DataControls get focused (by keyboard), What
> I have tried is:
>
> PUBLIC SUB DataControl8_GotFocus()
> Message.info("Got focus")
> END
>
> PUBLIC SUB DataControl8_KeyPress()
> Message.Info("Key press")
> END
>
> PUBLIC SUB DataControl8_MouseDown()
> Message.Info("Mouse down")
> END
>
> But nothing happens, the only way I knew that was focused was by the
> "Enter" event, I think thats wrong, since "Enter" sound more like "hit
> enter by keyboard", and the actual behavior is "action when focused by
> mouse (only)"
>
> What I want to do is an automatic process, something like, get number one,
> then get number two, and automatically give the sum, without the user needs
> to push a button or something (I am working with Datacontrols, since all
> the data must be saved)
>
> I wanted Focused since most user like to use TAB button to move in each
> field, so when the result field got focused, the sum would be calculated
> automatically (thats in some way automatic, in some way not, but thats a
> good (and fast for the user) option)
>
> Thanks in advance.

I found a workaround, so that DataControl will raise the Control events, but 
it is far from perfect: the events are raised by the true widget, and not the 
DataControl itself, so the LAST keyword is not meaningful inside the event 
handler. But this is better than nothing...

You will get in the next subversion commit.

Regards,

-- 
Benoit Minisini




More information about the User mailing list