Deye Posted September 10, 2018 Share Posted September 10, 2018 Hi, I need something that will look like this combo and act as a regular button Where the drop-down should extend only when the arrow is pressed not anywhere else in the button's body GUICtrlCreateUpdown might be an option but will have to find a way to link it to the button Thanks expandcollapse popupnclude <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <ComboConstants.au3> #include <WindowsConstants.au3> Example() Func Example() ; Create a GUI with various controls. Local $hGUI = GUICreate("Example", 300, 200) ; Create a combobox control. Local $idComboBox = GUICtrlCreateCombo("", 10, 10, 185, 20, BitOR($CBS_DROPDOWNLIST, $WS_VSCROLL)) Local $idButton_Close = GUICtrlCreateButton("Close", 210, 170, 85, 25) ; Add additional buttons to the combobox. GUICtrlSetData($idComboBox, "button 1|button 2", "button 1") ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) Local $sComboRead = "" ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idButton_Close ExitLoop Case $idComboBox $sComboRead = GUICtrlRead($idComboBox) MsgBox($MB_SYSTEMMODAL, "", "The combobox is currently displaying: " & $sComboRead, 0, $hGUI) EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc ;==>Example Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 10, 2018 Moderators Share Posted September 10, 2018 Deye, A "SplitButton" control seems to me like the solution - you code it like this: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <StructureConstants.au3> #include <GuiMenu.au3> $hGUI = GUICreate("Test", 500, 500) $cButton = GUICtrlCreateButton("Main", 10, 10, 80, 30, $BS_SPLITBUTTON) GUISetState() GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cButton MsgBox($MB_SYSTEMMODAL, "Chosen", "Main button") EndSwitch WEnd Func _WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) Local $tStruct = DllStructCreate($tagNMHDR, $lParam) If DllStructGetData($tStruct, "Code") = $BCN_DROPDOWN Then _Dropdown_Menu(DllStructGetData($tStruct, "hWndFrom")) EndIf EndFunc ;==>_WM_NOTIFY Func _Dropdown_Menu($hCtrl) Local Enum $iOption_1 = 1000, $iOption_2 Local $hMenu = _GUICtrlMenu_CreatePopup() _GUICtrlMenu_InsertMenuItem($hMenu, 0, "Option 1", $iOption_1) _GUICtrlMenu_InsertMenuItem($hMenu, 1, "Option 2", $iOption_2) Switch _GUICtrlMenu_TrackPopupMenu($hMenu, $hCtrl, -1, -1, 1, 1, 2) Case $iOption_1 MsgBox($MB_SYSTEMMODAL, "Chosen", "Option 1") Case $iOption_2 MsgBox($MB_SYSTEMMODAL, "Chosen", "Option 2") EndSwitch _GUICtrlMenu_DestroyMenu($hMenu) EndFunc ;==>_Dropdown_Menu M23 Deye 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Deye Posted September 10, 2018 Author Share Posted September 10, 2018 Hi Melba23, Right on "on the button" solution Thanks Deye 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