Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Same keycodes for different keystokes??
Message
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00349761
Message ID:
00350002
Views:
37
Hi Pablo,

>>I've read this discussion up to this message. We also have graphic toolbar. I advised my colleagues several times to use Menu on the Fly, e.g., when your form appears, the menu navigate appears too and allows to use all necessary hot keys. IMO, it's very good idea, but for my deepest regret, we still have so many others things to do, that this idea is still not implemented. Anyway, tell me, if this idea will work for you...
>>
>Yes, thanks to the replys works fine, for me it's very easy to implement. I explain:
>
>I have a form baseclass for all my forms, in this class I put keypreview = .T. for handling all the key events before the controls events. In the keypress of this baseclass I put:
>
>LPARAMETERS nKeyCode, nShiftAltCtrl
>DO CASE
> * CTRL + Home && First Record
> CASE nKeycode = 29 AND nshiftaltctrl = 2
> IF VARTYPE(oToolBar)="O" AND oToolBar.First.enabled = .T.
> oToolBar.First.Click()
> ENDIF
> NODEFAULT
> * CTRL + PagUp && Previous
> CASE nKeycode = 31 AND nshiftaltctrl = 2
> IF VARTYPE(oToolBar)="O" AND oToolBar.Previous.enabled = .T.
> oToolBar.Previous.Click()
> ENDIF
> NODEFAULT
>.
>.
>.
> * CTRL + N && New Record
> CASE nKeycode = 14 AND nshiftaltctrl = 2
> IF VARTYPE(oToolBar)="O" AND oToolBar.New.enabled = .T.
> oToolBar.New.Click()
> ENDIF
> NODEFAULT
>.
>.
>.
>ENDCASE
>
>Note that I check if the toolbar exists (cause can have some modal forms or forms I wouldn't like to allow access the toolbar), and if the button is enabled, if you get another key, this will go to the control.
>
>Works very good, at last.

I'm very glad, that it works, however, my idea is different. Instead of using this code in KeyPress event of your 'manager' form, I proposed the idea of creating menu on the fly. For example, when you're in VFP environment and open a program to modify, the menu Format appears. If you open a table, menu Table appears and so on. So, I assume, it's standard Windows behavior and a good UI practice. Therefore I believe, we can do the same for our custom class ToolBar. E.g. the first instance of ToolBar will instanciate a menu 'Navigate'. I don't know all details in implementation, but I saw several samples, which came with VFP.

This is my idea, and I think it's pretty obvious and standard. I would like to receive confirmation of somebody, what this idea is useful and not hard to implement.

Of course, if your application doesn't use menu at all, you still can keep your idea...

Thanks.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform