Page 1 of 1

How to disable menutitle ?

Posted: Mon Jun 09, 2003 12:38 pm
by eddy
...

Posted: Mon Jun 09, 2003 1:54 pm
by GPI
RTFM!


DisableMenuItem(MenuItem, Status)

Posted: Mon Jun 09, 2003 2:08 pm
by eddy
GPI wrote:RTFM!
DisableMenuItem(MenuItem, Status)
What ? DisableMenuItem can disable menuTitle and menuItem

Posted: Mon Jun 09, 2003 4:10 pm
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