HideMenuItem() ?
HideMenuItem() ?
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
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() ?
That's exactly what i needed today for the same reason. Any chance to get it within the next 6 years? 

PB 5.70 LTS (x64) - Debian Testing, Gnome 3.30.2
Re: HideMenuItem() ?
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.
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.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Re: HideMenuItem() ?
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...
PB 5.70 LTS (x64) - Debian Testing, Gnome 3.30.2
Re: HideMenuItem() ?
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.
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() ?
In one word: a complete menu editor
+1

+1
- Windows 11 Home 64-bit
- PureBasic 6.10 LTS (x64)
- 64 Gb RAM
- 13th Gen Intel(R) Core(TM) i9-13900K 3.00 GHz
- 5K monitor with DPI @ 200%
- PureBasic 6.10 LTS (x64)
- 64 Gb RAM
- 13th Gen Intel(R) Core(TM) i9-13900K 3.00 GHz
- 5K monitor with DPI @ 200%
-
- Addict
- Posts: 1482
- Joined: Tue Feb 22, 2011 1:16 pm
Re: HideMenuItem() ?
+1 to this request... I need to hide a menu item today but have to look for an API solution.
Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!
PureBasic: Born in 1998 and still going strong to this very day!
Re: HideMenuItem() ?
+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:
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() ?
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.skywalk wrote:Why is recreating the menu NOT an option?
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() ?
Maybe DisableMenu() is an option ?
Most commercial products only disable not relevant menu items....
Most commercial products only disable not relevant menu items....