[Gambas-user] Menu changed programmatically

Rolf-Werner Eilert eilert-sprachen at ...221...
Mon Mar 14 09:07:47 CET 2016


Am 11.03.2016 13:33, schrieb Benoît Minisini:
> Le 11/03/2016 12:47, Rolf-Werner Eilert a écrit :
>> Am 10.03.2016 18:12, schrieb Rolf-Werner Eilert:
>>> How to change the entries of a pop-up menu?
>>>
>>> I wanted to use a MenuButton like it is used in the Gambas IDE, i. e.
>>> not for a menu in the ordinary "menu" sense of the word, but for a list
>>> that reacts like a ComboBox.
>>>
>>> In this case, I would have to abuse the pop-up menu that is linked to
>>> the MenuButton. But how can I access the entries of a menu during
>>> runtime? I haven't found anything about it in the documentation.
>>>
>>> Regards
>>> Rolf
>>>
>>>
>>>
>> I know the sources for the IDE must be somewhere... I've been looking
>> for them to find out how you realised this thing, but to no avail.
>>
>> But anyway, can somebody tell me how these two buttons in the IDE are made?
>>
>> Thanks
>> Rolf
>>
> If you want to make a ComboBox, you don't need a Menu, but the
> ShowPopup() method of the Window class.
>
> Otherwise, a menu is modified through its name. If you define the menu
> name as "mnuOpen", for example, than you get a variable named "mnuOpen"
> pointing at the menu object.
>
> Regards,
>

Yes, but when I first saw this thing, I expected to find a list equal to 
that in a ComboBox, where I can add and delete items during runtime. So, 
if I want this functionality with a menu, I will have to make a menu 
with a given number of items, then change their captions, switch them 
visible on or off, and jump to their Click events in code... Terribly 
roundabout.

I cannot imagine you used it like this in the Gambas IDE, so I asked 
where in the sources I can find it. What I mean is the Open Project and 
Back button. Or are these something completely different?

Regards
Rolf





More information about the User mailing list