[Gambas-user] Limiting Input

Rob sourceforge-raindog2 at ...94...
Tue Sep 9 07:02:52 CEST 2003


On Sunday 07 September 2003 22:32, Tahara wrote:
> in VB, i can limit keyboard input. for example, if i want the
> user when pressing a character in a textbox it just a number
> that the user can press or just the the character.. have you
> guys any example for gambas ?

Not an example per se, but if you change the KeyPress event 
handler for that textbox from a Sub to a Function (as Boolean), 
returning True from that function will prevent the character 
from being inserted into the textbox.  So you can do whatever 
validation you need to and prevent the user from inserting stuff 
he shouldn't be typing.

This isn't well-documented, but you can verify it in the 
http://www.binara.com/gambas-wiki/bin/view/Gambas/GambasEventsDeclaration
(or type GambasEventsDeclaration into the Go box on the wiki) 
page.  I guess I should add it to DifferencesFromVB.

Rob





More information about the User mailing list