[Gambas-user] Menu.Group property???

Benoît Minisini gambas at ...1...
Wed Jul 11 15:39:55 CEST 2012


Le 11/07/2012 05:12, Bruce a écrit :
> On Tue, 2012-07-10 at 18:57 +0200, Tobias Boege wrote:
>> On Tue, 10 Jul 2012, Bruce wrote:
>>> The menu editor exposes (what looks like) a property called "Group" and
>>> if it is set I can use that name instead of the actual menu name in the
>>> event handler for all menu items in the same group.
>>>
>>> This is really handy in the IDE when coupled with LAST.
>>>
>>> But I can't set the Group "property" in code when adding menu items on
>>> the fly?
>>>
>>> Bruce
>>>
>> I don't know where it can be read, possibly in this "property information box" you see in the
>> property window when editing a specific property (just below the properties listing): this is
>> a pseudo-property not available at runtime. It just sets the event name of all the affected controls
>> to the given string at creation time (wasn't there recently discussion about a $Load method which
>> does this job?)
>> If I remember correctly...
>>
>> Regards,
>> Tobi
>>
>
> Aha!  Solved it by using an observer in the class that manages my
> dynamic menus.
>
> Gambas is such a thing of beauty.  :-)
>
> Bruce
>
>
> p.s. Tobi, you can see the Group name for a menu item in the .form file
> as a suffix to the Menu item, e.g.
> { mnuGroup Menu
>      Text = ("Grouped Menu")
>      { mnuGroupItem1 Menu MyGroup   <----!
>        Name = "mnuGroup1"
>        Text = ("G1")
>      }
>    }
> similarly for other controls
>    { txtData TextArea AnotherGroup   <---!
>      Name = "txtData"
>      MoveScaled(7,2,38,38)
>      Expand = True
>    }
>
> I wonder why the IDE Group attribute was not given property status by
> Benoit?
>

The "group" name is the event name as specified at object creation.

In other words, the compiler transforms

{ mnuGroup Menu
   ...
   { mnuGroupItem1 Menu MyGroup

into

mnuGroupItem1 = new Menu(menuGroup) As "MyGroup"

Look at the documentation of the NEW instruction.

Regards,

-- 
Benoît Minisini






More information about the User mailing list