[Gambas-user] Class Key

David Villalobos Cambronero david_villalobos_c at ...43...
Mon Nov 12 13:47:17 CET 2007


Hi all, it is just a small question... but as usual, I want to know why...

I add this SUB to my Forms so they can be closed I the user press the ESC key:

PUBLIC SUB Form1_KeyPress()

    IF Key.Code = Key.Esc THEN
        ME.Close()
    END IF

END SUB

I thought this code should work:

    IF Key.Esc THEN

        ME.Close()

    END IF

    ... And actually does, but the Form is closed if you press: ESC, ALT, TAB, SHIFT and BLOQ.

I now Key.Esc is a Constant not a Property, but I you press A, B, F1, etc, the Form isn't closed.

My question is: Why if we press: ESC, ALT, TAB, SHIFT and BLOQ, Key.Esc returns TRUE, and if we press: A, B, F1, etc, it retuns FALSE?

I don't know if it is a bug or I'm doing something wrong...

Best regards...

David





__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Error-0.0.1.tar.gz
Type: application/gzip
Size: 4163 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20071112/84007ede/attachment.gz>


More information about the User mailing list