[Gambas-user] Creating Actions at runtime

Benoît Minisini g4mba5 at gmail.com
Sat Sep 29 13:31:07 CEST 2018


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


More information about the User mailing list