How to disable menutitle ?

Just starting out? Need help? Post your questions and find answers here.
User avatar
eddy
Addict
Addict
Posts: 1479
Joined: Mon May 26, 2003 3:07 pm
Location: Nantes

How to disable menutitle ?

Post by eddy »

...
GPI
PureBasic Expert
PureBasic Expert
Posts: 1394
Joined: Fri Apr 25, 2003 6:41 pm

Post by GPI »

RTFM!


DisableMenuItem(MenuItem, Status)
User avatar
eddy
Addict
Addict
Posts: 1479
Joined: Mon May 26, 2003 3:07 pm
Location: Nantes

Post by eddy »

GPI wrote:RTFM!
DisableMenuItem(MenuItem, Status)
What ? DisableMenuItem can disable menuTitle and menuItem
GPI
PureBasic Expert
PureBasic Expert
Posts: 1394
Joined: Fri Apr 25, 2003 6:41 pm

Post by GPI »

Ups, don't read right, but you have luck:

Code: Select all

If OpenWindow(0, 200, 200, 220, 100, #PB_Window_SystemMenu, "SubMenu Example") 
    If CreateMenu(0, WindowID()) 
      MenuTitle("Project") 
        MenuItem(1, "Open")  
        MenuItem(2, "Close") 
      MenuTitle("2") 
        OpenSubMenu("Recent files")       ; beginne Erstellung des Unter-Menüs 
          MenuItem( 3, "C:\Autoexec.bat") 
          MenuItem( 4, "D:\Test.txt") 
        CloseSubMenu()                    ; beende Unter-Menü 
    EndIf 
    
    mid=GetMenu_(WindowID())
    enablemenuitem_(mid,0,#MF_BYPOSITION|#MF_GRAYED)
    DrawMenuBar_(WindowID())
    For i=1 To 500
      Delay(1)
      windowevent()
    Next
    beep_(1,1)
    enablemenuitem_(mid,0,#MF_BYPOSITION|#MF_ENABLED)
    enablemenuitem_(mid,1,#MF_BYPOSITION|#MF_Disabled)
    DrawMenuBar_(WindowID())
    Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow 
  EndIf 
After the beep, menu-2 is deaktivated, you can't open this menu, but is don't grayed.

GPI
Post Reply