AndyS01 Posted December 13, 2013 Share Posted December 13, 2013 I'm building a system menu that has 2 groups of selections and I want to add a header for each group but I cannot see how to do it. I'd like to make them bold and also not clickable (like the separator line is) I tried _GUICtrlMenu_SetItemHighlighted() but that didn't work. Here is my test code: expandcollapse popupOpt("GUICloseOnESC", 1) ; ESC closes GUI Opt("GUIOnEventMode", 1) ; Change to OnEvent mode Opt('MustDeclareVars', 1) OnAutoItExitRegister("ExitStageLeft") #include <GUIConstantsEx.au3> #include <GuiMenu.au3> Global $hMainWin _Main() Func _Main() $hMainWin = GUICreate("test", 300, 300) create_menus() GUISetState() GUISetOnEvent($GUI_EVENT_CLOSE, 'ExitStageLeft') While (1) Sleep(500) WEnd EndFunc ;==>_Main Func ExitStageLeft() Exit (1) EndFunc ;==>ExitStageLeft Func create_menus() Local $iID_Menu, $id1, $id2 $iID_Menu = GUICtrlCreateMenu("&Test") GUICtrlCreateMenuItem("Some entry", $iID_Menu) GUICtrlCreateMenuItem("another entry", $iID_Menu) GUICtrlCreateMenuItem("", $iID_Menu) $id1 = GUICtrlCreateMenuItem("Header 1:", $iID_Menu) GUICtrlCreateMenuItem("Item 1", $iID_Menu) GUICtrlCreateMenuItem("Item 2", $iID_Menu) GUICtrlCreateMenuItem("", $iID_Menu) _GUICtrlMenu_SetItemHighlighted($iID_Menu, $id1, True) $id2 = GUICtrlCreateMenuItem("Header 2:", $iID_Menu) GUICtrlCreateMenuItem("Item 3", $iID_Menu) GUICtrlCreateMenuItem("Item 4", $iID_Menu) EndFunc ;==>create_menus Link to comment Share on other sites More sharing options...
funkey Posted December 13, 2013 Share Posted December 13, 2013 I'm not sure if there is an easy way in doing this. I don't think so, but maybe with 'modern menu UDF'.But why not this way:expandcollapse popupOpt("GUICloseOnESC", 1) ; ESC closes GUI Opt("GUIOnEventMode", 1) ; Change to OnEvent mode Opt('MustDeclareVars', 1) OnAutoItExitRegister("ExitStageLeft") #include <GUIConstantsEx.au3> #include <GuiMenu.au3> Global $hMainWin _Main() Func _Main() $hMainWin = GUICreate("test", 300, 300) create_menus() GUISetState() GUISetOnEvent($GUI_EVENT_CLOSE, 'ExitStageLeft') While (1) Sleep(500) WEnd EndFunc ;==>_Main Func ExitStageLeft() Exit (1) EndFunc ;==>ExitStageLeft Func create_menus() Local $iID_Menu, $id1, $id2 $iID_Menu = GUICtrlCreateMenu("&Test") GUICtrlCreateMenuItem("Some entry", $iID_Menu) GUICtrlCreateMenuItem("another entry", $iID_Menu) GUICtrlCreateMenuItem("", $iID_Menu) $id1 = GUICtrlCreateMenu("Header 1:", $iID_Menu) GUICtrlCreateMenuItem("Item 1", $id1) GUICtrlCreateMenuItem("Item 2", $id1) GUICtrlCreateMenuItem("", $iID_Menu) $id2 = GUICtrlCreateMenu("Header 2:", $iID_Menu) GUICtrlCreateMenuItem("Item 3", $id2) GUICtrlCreateMenuItem("Item 4", $id2) EndFunc ;==>create_menus Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now