[Gambas-user] Creating Actions at runtime
Me
adamnt42 at gmail.com
Sun Sep 30 06:05:48 CEST 2018
On Sat, 29 Sep 2018 13:31:07 +0200
Benoît Minisini <g4mba5 at gmail.com> wrote:
> Le 29/09/2018 à 12:37, Me a écrit :
> >>>
> >>> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
> >>>
> >>
> >> The Action._Register() method is called each time the Action property of
> >> a control changes.
> >>
> >> --
> >> Benoît Minisini
> >>
> >> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
> >
> > Aha! Does that happen for menus as well?
> > More tomorrow, I'll have a look-see.
> > b
> >
>
> In the last commit, I have added two new methods to the Action class
> defined in gb.form.mdi:
>
> Action.Add() declares a new action. You have to give all the action
> properties: the action name, the text, the icon url, if the action can
> have a shortcut, and the default shortcut.
>
> Action.AddFrom() does the same thing, but from a control.
>
> Beware that as a Picture object never knows that it has been created
> from the stock, Action.AddFrom() cannot guess the icon url associated
> with a control.
>
> I decided not to add actions automatically through the
> Action._Register() method I told you previously, because it's too hard
> to handle.
>
> Regards,
>
> --
> Benoît Minisini
>
> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
Works well! But ... :-)
Something strange happened. Some of the normal menus i.e. the ones configured
via the form designer no longer appear in the shortcut editor, some do?? To make
them re-appear I had to delete them and re-add them, then everything works.
(I am looking at the .actions files and see some strange things like menus with "no
text" even though they actually do have text/caption. Maybe this is not related?
I'll do some more checking.)
regards
Bruce
--
adamant42 at gmail.com
More information about the User
mailing list