[Gambas-user] Question of shortcut keys position

Benoît Minisini g4mba5 at gmail.com
Tue Apr 24 18:16:00 CEST 2018


Le 24/04/2018 à 18:06, Gianluigi a écrit :
> 
> 
> 2018-04-24 17:33 GMT+02:00 Benoît Minisini <g4mba5 at gmail.com 
> <mailto:g4mba5 at gmail.com>>:
> 
>     Le 24/04/2018 à 17:18, Gianluigi a écrit :
> 
>         Hi Benoit,
>         I have not completely understood this suggestion:
>         "You should not decide for the user of your library which
>         shortcut he wants to use."
>         But is not it always the programmer who decides what the
>         shortcut keys of his application will be?
>         Is not it normal to reserve F1 and F2 for help?
>         This application is a utility if the shortcut keys are in the
>         main module is not easier for the programmer to intervene and
>         change them?
> 
>         Regards
>         Gianluigi
> 
> 
>     No, shortcuts should be configurable.
> 
>     In Gambas, this is done through :
> 
>     - The "Action" property of a control.
> 
>     - The "Shortcut" associated with a menu entry having its Action
>     property set.
> 
>     - the gb.form.mdi component that adds support for configuring these
>     shortcuts.
> 
>     At the moment, this is not possible to have an action with a
>     shortcut outside of a menu entry.
> 
>     I suggest that you don't try to handle the shortcut. Just offer a
>     method to show your help browser, and let the user of your library
>     manage the shortcuts as he likes.
> 
>     -- 
>     Benoît Minisini
> 
> 
> What you have just given me is a great teaching.
> Thank you so much
> 
> Regards
> Gianluigi
> 

Well, if you didn't know, gb.form.mdi (which is not just a component for 
multi-document interface) provides you a Toolbar container:

- Every control put in it with the Action property set will be configurable.

- If the action of a control (which is just a string) starts with a 
point, then this action is assumed local to the form of the control. 
Otherwise it is a global action.

- The Action class allows you to enable, disable actions. All controls 
having the same action are handled in one shot.

Just use the IDE toolbars and menus, and you see how it works.

Regards,

-- 
Benoît Minisini


More information about the User mailing list