[Gambas-user] Creating Actions at runtime

Benoît Minisini g4mba5 at gmail.com
Thu Sep 27 14:48:47 CEST 2018


Le 27/09/2018 à 05:33, Me a écrit :
> On Fri, 21 Sep 2018 09:49:27 +0200
> Gianluigi <bagonergi at gmail.com> wrote:
> 
>>   Thanks Gianluigi. (I missed your post somehow the other day).
> 
> Well, it looks like what I wanted to do is not possible.
> 
> Some observations. (Mainly for my own interest as I will probably need to refer to this later in time.)
> 1) The Action.Configure() function uses the form defined in the gb.gui.mdi component.
> Which is interesting! At least I was able to redefine the size of the pop-up to something more
> reasonable.
> 1a) That shortcut editor only looks at the files in the .action sub-directory (or the executable archive
>   version thereof) of the active project to build its' list of "editable" actions. In addition, it will only add
> actions that have a defined shortcut already.
> This then, means that all user configurable shortcuts must be defined statically in the project design as
> that is the only way they will get into the .action files.
> 2) Really bewildering! Creating a menu item at runtime, works. Further, the Action and Shortcut defined
> in the code operate as expected. I can evidence this by creating a couple of menus in the code, one of
> which hides or shows the other using the Action defined for the other. However, these items do not
> appear in the Action,List array?
> I thought I might be able to use the Action.List array and build my own shortcut editor. No joy.
> 
> 

Maybe creating an Action.Add() method is the solution?

Better would be doing that automatically, when the control is created.

But it is harder, because how to know that the newly created control was 
not already part of the actions defined in the ".action" directory?

-- 
Benoît Minisini


More information about the User mailing list