[Gambas-user] Select an entry in a combo or list box by keypress - Is there a better way.
Benoit Minisini
gambas at ...1...
Sat Sep 13 15:15:55 CEST 2008
On samedi 13 septembre 2008, Ian Roper wrote:
> It would be nice to have this as a standard method for these sort of
> controls. :)
>
You can actually do that easily in your own projects by reimplementing these
controls.
For example, for the ListBox, creates a "ListBox" class in your project, and
put that in it:
--8<-- ListBox.class ----------------------------------------------
EXPORT
PRIVATE $hObserver AS Observer
PUBLIC SUB _new()
$hObserver = NEW Observer(ME) AS "ListBox"
END
PUBLIC SUB ListBox_KeyPress()
' Put your code there
...
END
PUBLIC SUB ListBox_LostFocus()
' Put your code there
...
END
-------------------------------------------------------------------
Normally (I didn't test!), all ListBox controls will gain your key management
automatically. Then you can do that for other controls if you want.
If it does not work, it should be a bug in Gambas!
And, as Doriano said, UCase() works only with ASCII strings. So you should use
String.UCase() instead, which deals with UTF-8 strings.
Regards,
--
Benoit Minisini
More information about the User
mailing list