Page 1 of 1
Dynamic Menus
Posted: Tue Jun 09, 2009 7:31 pm
by gedumer
How can I add new menu items to a submenu during runtime? Submenus don't have an ID when they're created... just a text entry. For example, in the PB example file, menu.pb, there is a submenu titled "Recents". What if you wanted to add new file names to that list during runtime... how would I do that?
Posted: Tue Jun 09, 2009 7:39 pm
by Fluid Byte
Recreate the menu or use API.
Posted: Tue Jun 09, 2009 7:59 pm
by gedumer
Fluid Byte wrote:Recreate the menu or use API.
I would have to recreate the entire menu from the top down... wouldn't that cause screen flash or some other disburbing effect?
P.S. I don't want to use API since it is multi-platform.
Posted: Tue Jun 09, 2009 8:03 pm
by srod
Yes it can cause a minor screen flash, but nothing untoward really.
Posted: Tue Jun 09, 2009 8:17 pm
by Fred
the PB IDE uses this to update the whole menu when changing of language, and it works as expected.
Posted: Tue Jun 09, 2009 8:23 pm
by gedumer
I'm currently experimenting with it and it seems to be working properly without any negative side effects for now.
Thanks...
Posted: Tue Jun 09, 2009 10:31 pm
by DoubleDutch
I use a different method - no need to recreate the menu at all. See the bottom of this thread:
http://www.purebasic.fr/english/viewtopic.php?t=37401