LividCode Posted April 6, 2013 Share Posted April 6, 2013 I am trying to figure out how to detect if a user clicks the button for a toolbar item or the dropdown arrow of the button and which button/dropdown it was. If the drop down arrow was clicked I am wanting to show a menu. All the examples i seem to find for the toolbar don't show whether the bottom alone was clicked or the drop down arrow. Also They all seem to do the events on BUTTONDOWN. I want to use Button UP. Any Help would be great. Thanks expandcollapse popup#include #include #include #include #include #include #include #include GUIRegisterMsg($WM_LBUTTONUP, "_WM_LBUTTONUP") Global $hLeftClick _Main() Func _Main() _CreateMainGUI() GUISetState() ; display the GUI While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $hLeftClick ; Our dummy control clicked MsgBox(0, "Click", "LEFT CLICK!") EndSwitch WEnd EndFunc Func _CreateMainGUI() $mainFrm = GUICreate("Test", 623, 150, 192, 124, BitOR($GUI_SS_DEFAULT_GUI,$WS_MAXIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_TABSTOP)) ;Create GUI form GUISetIcon(@ScriptDir & "\resources\1364868664_60322.ico", -1) $hToolbar = _GUICtrlToolbar_Create($mainFrm, $TBSTYLE_FLAT) $aSize = _GUICtrlToolbar_GetMaxSize($hToolbar) _GUICtrlToolbar_SetExtendedStyle($hToolbar, $TBSTYLE_EX_DRAWDDARROWS) ;add images for toolbar Global $hImage = _GUIImageList_Create(32, 32, 5) _GUIImageList_AddIcon($hImage, @ScriptDir & "\resources\explorer.ico", 0, True) _GUIImageList_AddIcon($hImage, @ScriptDir & "\resources\cmd.ico", 0, True) _GUICtrlToolbar_SetImageList($hToolbar, $hImage) ;Assign the image list to toolbar ;setup button text $explorer_button_txt = _GUICtrlToolbar_AddString($hToolbar, "Explorer") $cmd_button_txt = _GUICtrlToolbar_AddString($hToolbar, "Command Prompt") ;add toolbar buttons _GUICtrlToolbar_AddButton($hToolbar, 1000, 0, $explorer_button_txt, $BTNS_DROPDOWN) _GUICtrlToolbar_AddButton($hToolbar, 1001, 1, $cmd_button_txt, $BTNS_DROPDOWN) ; Create a dummy control for the handler to action $hLeftClick = GUICtrlCreateDummy() EndFunc Func _WM_LBUTTONUP($hWnd, $iMsg, $wParam, $lParam) ; Action the dummy control GUICtrlSendToDummy($hLeftClick) EndFunc Link to comment Share on other sites More sharing options...
kylomas Posted April 8, 2013 Share Posted April 8, 2013 LividCode, Take a look at the example code for _GUICtrlToolbar_SetExtendedStyle in the help file. kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
LividCode Posted April 9, 2013 Author Share Posted April 9, 2013 Eh? LOL Sorry, for being stupid. I was having a moment apparently. Thanks. Link to comment Share on other sites More sharing options...
kylomas Posted April 9, 2013 Share Posted April 9, 2013 Eh? LOL Sorry, for being stupid. I was having a moment apparently. Thanks.Sorry, you can't have "moments", I've used them all up. Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill 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