Page 1 of 1
HideMenuItem() ?
Posted: Fri Jun 15, 2007 12:22 am
by ebs
It would be great if there was a HideMenuItem() command, similar to the
existing DisableMenuItem().
I just added a most recently used (MRU) file list to the menu in a Visual Basic project.
It was easy since VB has this command.
Does anyone have any suggestions how to do this in PureBasic?
Without having to delete and re-create the menu each time the MRU list needs to change, of course.
API solutions for Windows would be OK, since that's the only platform I need to support.
Thanks,
Eric
Re: HideMenuItem() ?
Posted: Sat Mar 16, 2013 10:06 pm
by uwekel
That's exactly what i needed today for the same reason. Any chance to get it within the next 6 years?

Re: HideMenuItem() ?
Posted: Sat Mar 16, 2013 10:18 pm
by skywalk
Why is recreating the menu NOT an option?
If you plan to do this, just make a structured array of your menuitems and each item status and loop through in a blink.
You can tuck all this menu stuff in a procedure that handles all your menu possibilities.
Re: HideMenuItem() ?
Posted: Sat Mar 16, 2013 10:39 pm
by uwekel
Ok that works, but really, it is more than common to have such commands to remove or at least hide menu items. It is not just recreating the menu but also restore the menu item disabled states, images and so on. Just to hide one item...
Re: HideMenuItem() ?
Posted: Sat Mar 16, 2013 11:45 pm
by Tenaja
I will +1 this, and add another request...
AddMenuItem() ; Adds an item to a random menu
MenuItemCount() ; Returns the number of items in a Menu
These few features will make adding plug-ins to the menu much simpler.
Re: HideMenuItem() ?
Posted: Sat Mar 23, 2013 7:15 am
by charvista
In one word: a complete menu editor
+1
Re: HideMenuItem() ?
Posted: Sat Jun 01, 2013 6:27 am
by MachineCode
+1 to this request... I need to hide a menu item today but have to look for an API solution.
Re: HideMenuItem() ?
Posted: Mon Jan 04, 2016 9:46 am
by Keya
+1! But perhaps it's not possible cross-OS to hide a child menu item without recreating the menu?
The following fails to hide the child menu:
Code: Select all
Enumeration FormMenu
#mnuParent
#mnuChild
EndEnumeration
Procedure OpenDlg1(x = 0, y = 0, width = 390, height = 220)
OpenWindow(0, x, y, width, height, "Hide Child Menu", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CreateMenu(0, WindowID(0))
MenuTitle("Menu")
OpenSubMenu("Parent")
MenuItem(#mnuChild, "Child")
CloseSubMenu()
HideMenu(#mnuChild,1)
EndProcedure
Procedure Dlg1_Events(event)
ProcedureReturn #True
EndProcedure
OpenDlg1()
Repeat
Event = WaitWindowEvent()
Dlg1_Events(Event)
Until Event = #PB_Event_CloseWindow
Re: HideMenuItem() ?
Posted: Wed Feb 03, 2016 10:33 am
by mhs
+1
Re: HideMenuItem() ?
Posted: Wed Feb 03, 2016 10:41 pm
by Dude
skywalk wrote:Why is recreating the menu NOT an option?
Low memory is one reason. Just because a menu was created successfully at the start of your app, doesn't mean you'll be able to recreate it again later.
Besides, what you're asking is the same as asking why NOT recreate the entire GUI for your app when you just want to change the text on a button.

Re: HideMenuItem() ?
Posted: Thu Feb 04, 2016 9:55 am
by Bisonte
Maybe DisableMenu() is an option ?
Most commercial products only disable not relevant menu items....