On 03.08.2012, at 08:16, David FLEURY <[email protected]> wrote:

> Le 03/08/2012 00:43, Greg Ercolano a écrit :
>>      Just never store the pointer, always resolve it with the path.
>> 
>>      If you need a pointer that doesn't change, use the menu item's 
>> userdata();
>>      this can point to a data structure of your own making, and will survive
>>      add/insert/delete.
>> 
>>      I use that technique in multilanguage apps where I have the menu
>>      display one thing, but keeps the 'real' pathname in a string managed
>>      by the userdata.
> 
> My issue is that mnemonic and shortcut are created dynamically by 
> configuration, so the path change during the life of the menu bar.
> 
> I will see to Menu_Bar source code.

Unless you plan to change the size of you menus, you can simply allocate an 
array and assign variables to the members of the array. You should be able to 
simply allocate multiple items and have an array as a result (if the C compiler 
is implemented correctly). Even if the size of the menu changes, (for example 
with a recent files menu), you can use hide() and show() to make menu items 
disappear temporarily.

IMHO best practice is to use FLUID. You can assign variable names to each menu 
item and use thos later to change labels or shortcut, query values, anything 
you need.

---


_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to