Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
'on key label ' command broke table index......... : (
Message
From
09/12/1998 23:23:38
 
 
To
09/12/1998 19:29:29
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00165873
Message ID:
00165928
Views:
16
>hi every one.
>I have experienced very awesome situation about on key label command.
>
>I have a mainform and subform in my program.
>and I need to assign hot keys to 2 forms...
>
>the first mainform has assigned in the init event.
> => on key label 'ALT+N' mainform.cmdAdd.click
>
>and subform has assigned in the form's gotfocus event.
> => push key
> on key label 'ALT+N' subform.cmdAdd.click
>
> subform has assigned in the form's lostfocus event.
> => pop key ( restore mainform's hot key assignment )
>
>now....it seems very works well....
>( ** all of cmdADD's command is 'append blank' command... ** )
>
>But!!!!!!
>Sometimes or Manytimes, it broked my subform's table indexes....
>I think that it may be memory curruption? or
>in my fault?

ON KEY LABEL commands are interprocess commands. That means OKL commands will interrupt running code to run their own, as you have found out, this can cause intersting and troubling results.

A more dependable way to do what you want to do is to put your code in the Form.Keypress event and set Form.KeyPreview = .T.
But since the hot key you wantto use is an 'ALT' combination, and 'ALT' combinations don't fire the Form.Keypress event, you can use another trick:

put another button on each form and move it off screen so it can't be seen. Set the button's caption to \<N and put THISFORM.cmdAdd.Click() in the new button's click event.

Of course, an easier way would be to change your hot key to ALT+A, and then change the add button's caption to \<A.
Erik Moore
Clientelligence
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform