Dynamic Menus

Everything else that doesn't fall into one of the other PB categories.
gedumer
User
User
Posts: 48
Joined: Wed Jun 03, 2009 9:04 pm

Dynamic Menus

Post 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?
User avatar
Fluid Byte
Addict
Addict
Posts: 2336
Joined: Fri Jul 21, 2006 4:41 am
Location: Berlin, Germany

Post by Fluid Byte »

Recreate the menu or use API.
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
gedumer
User
User
Posts: 48
Joined: Wed Jun 03, 2009 9:04 pm

Post 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.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Yes it can cause a minor screen flash, but nothing untoward really.
I may look like a mule, but I'm not a complete ass.
Fred
Administrator
Administrator
Posts: 18556
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

the PB IDE uses this to update the whole menu when changing of language, and it works as expected.
gedumer
User
User
Posts: 48
Joined: Wed Jun 03, 2009 9:04 pm

Post by gedumer »

I'm currently experimenting with it and it seems to be working properly without any negative side effects for now.

Thanks...
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post 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
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
Post Reply