[Gambas-user] Two more questions about Action

Gianluigi bagonergi at gmail.com
Sun Apr 29 18:30:34 CEST 2018


2018-04-29 17:44 GMT+02:00 Benoît Minisini <g4mba5 at gmail.com>:

> Le 29/04/2018 à 11:37, Gianluigi a écrit :
>
>> I am a distracted person and yesterday I was more than usual. :-(
>> Now Enabled works, sorry.
>> See the attached project
>> I doubt if I have understood the meaning of Local
>>
>> Regards
>> Gianluigi
>>
>>
> Yes, it is a bit difficult to explain.
>
> 1) When you do Action["xxx"], all controls whose Action is set to "xxx"
> are returned.
>
> 2) Action[] takes a second argument that indicated the observer of the
> action. If not specified, all controls associated with that action are
> returned.
>
> 3) Action names starting with a point are (almost) just a convention that
> means that they intend to be local to their current event observer (usually
> their form).
>
> 4) Actions starting with a point have the same shortcuts as the action
> without the initial point.
>
> 5) Control having the same action are supposed to have the same text and
> the same icon. If you don't, the text and the icon of one of the control
> will be used.
>
> Example :
>
> In the IDE, you have a form for editing Gambas source code. You can have
> multiple instances of that form, if you have opened several sources files.
>
> In that form, you have a button to undo the last change. It is associated
> with the ".undo" action.
>
> If you lock the form, the ".undo" action is hidden, but only for that
> form. The undo buttons of the other forms must keep being visible!
>
> 1) If I do Action[".undo"].Visible = False, all undo buttons of all forms
> will be hidden.
>
> 2) So I have to do Action[".undo", Me].Visible = False in the source code
> of the form (hence Me represents the form, the event observer of the
> toolbar button and the menu entry I want to hide).
>
> 3) As the undo action must be hidden in one form only, I name it a "local"
> action. I must start it with a point so that the Action class acts
> correctly.
>
> 4) If you change the shortcut of the "undo" action in the shortcut
> configuration dialog, you will see that there is only one shortcut for all
> "undo" action everywhere.
>
> 5) You could have a "global" undo action named "undo" too (usually you
> don't. An action is either local or global, like "open-project"). It will
> have the same shortcut than ".undo".
>
> 6) See "local" action like a "dynamic variable", and "global" action like
> a "static variable".
>
> I hope things are clearer now.
>
> --
> Benoît Minisini
>
>
Hi Benoit,
I thank you for the very detailed explanation.
I take some time to study it well.
I like the example on 'undo' and I can see the horizon.
I will let you know.

You're always very kind.
Regards
Gianluigi


> --------------------------------------------------
>
> This is the Gambas Mailing List:
> https://lists.gambas-basic.org/listinfo/user
>
> Search the list:
> https://lists.gambas-basic.org/cgi-bin/search.cgi
>
> Hosted by https://www.hostsharing.net
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20180429/770425b3/attachment.html>


More information about the User mailing list