mattw112 Posted December 22, 2018 Posted December 22, 2018 I have a combo box on my form GUICtrlCreateCombo("", 24, 152, 1240, 100, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL)) But the down arrow at the end of it is tiny in terms of width, compared to the rest of it. This app is running on a tablet and I want people to use their finger to select, which they can... but some times it is hard. Is there a way to make the down arrow piece wider? Terry
Deye Posted December 23, 2018 Posted December 23, 2018 (edited) mattw112, With a little tinkering, you can have the button size set as you wish .. Try this as an example: #include <GuiComboBox.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Example() Func Example() GUICreate("Example", 400, 296) $idCombo = GUICtrlCreateCombo("test", 88, 148, 200, 21, BitOR($CBS_DROPDOWNLIST, $WS_VSCROLL)) GUICtrlSetState(-1, $GUI_HIDE) $idEdit = GUICtrlCreateInput("test", 88, 139, 171, 21) $hBtn = GUICtrlCreateButton(Chr(130), 269, 136, 32, 25) GUICtrlSetFont(-1, 13, 600, -1, "WingDings 3") _GUICtrlComboBox_BeginUpdate($idCombo) _GUICtrlComboBox_AddDir($idCombo, @WindowsDir & "\*.exe") _GUICtrlComboBox_EndUpdate($idCombo) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hBtn _GUICtrlComboBox_ShowDropDown($idCombo, True) Case $idCombo GUICtrlSetData($idEdit, GUICtrlRead($idCombo)) EndSwitch WEnd EndFunc Deye Edited December 23, 2018 by Deye
Moderators Melba23 Posted December 23, 2018 Moderators Posted December 23, 2018 mattw112, I believe that the width of the arrow is set by the SM_CXVSCROLL system setting - and so any changes will affect every combo and vertical scrollbar in the whole system. This thread shows how you might go about changing these system values - the actual constants for each metric are shown in the help file under _WinAPI_GetSystemMetrics. M23 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
mikell Posted December 26, 2018 Posted December 26, 2018 (edited) On 22/12/2018 at 5:41 PM, mattw112 said: This app is running on a tablet and I want people to use their finger to select The most convenient way in this case is an easy workaround Just use a larger transparent area around the toggle button of the combo, so even though the finger doesn't exactly touch the button then it will work anyway #include <GUIConstants.au3> #Include <GuiComboBox.au3> $gui = GUICreate("My GUI combo", 300, 150) $combo = GUICtrlCreateCombo ("", 10, 10, 150, 120) GUICtrlSetData($combo, "item1|item2|item3", "item3") $label = GUICtrlCreateLabel ("", 140, 5, 60, 30) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit If $msg = $label Then _GUICtrlComboBox_ShowDropDown($combo, _ not _GUICtrlComboBox_GetDroppedState($combo)) Wend Edited December 26, 2018 by mikell
Deye Posted December 26, 2018 Posted December 26, 2018 just a small update: alternative "dropdownarrow" using the Segoe MDL2 font \ icons the example mimics the combo + the $CBS_AUTOHSCROLL behavior in this link you can find (Get the Segoe UI and MDL2 icon fonts) to get the fonts updated or installed expandcollapse popup#include <GuiComboBox.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GUIConstants.au3> Global $hGUI = GUICreate("Example", 400, 296) Global $idCombo = GUICtrlCreateCombo("Example", 101, 47, 197, 21, BitOR($CBS_DROPDOWNLIST, $WS_VSCROLL)) GUICtrlSetState(-1, $GUI_HIDE) Global $idInput = GUICtrlCreateInput("", 101, 38, 160, 21) $hBtn = GUICtrlCreateButton(ChrW(0xE70D), 260, 37, 40, 22) GUICtrlSetFont(-1, 13, 600, -1, "Segoe MDL2 Assets") GUICtrlSetColor(-1, 0) _GUICtrlComboBox_BeginUpdate($idCombo) _GUICtrlComboBox_AddDir($idCombo, @WindowsDir & "\*.exe") _GUICtrlComboBox_EndUpdate($idCombo) _GUICtrlComboBox_DeleteString($idCombo, 0) GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hBtn _GUICtrlComboBox_ShowDropDown($idCombo, True) ControlFocus($hGUI, "", $idCombo) Case $idCombo GUICtrlSetData($idInput, GUICtrlRead($idCombo)) EndSwitch WEnd Func InputFormated() Local $s = GUICtrlRead($idInput) Local $i = _GUICtrlComboBox_FindString($idCombo, $s) If $i <> -1 Then _GUICtrlComboBox_SetCurSel($idCombo, $i) GUICtrlSetData($idInput, GUICtrlRead($idCombo)) EndIf EndFunc ;==>InputFormated Func _WM_COMMAND($hWnd, $Msg, $wParam, $lParam) If $hWnd = $hGUI And _WinAPI_HiWord($wParam) = $EN_CHANGE And _WinAPI_LoWord($wParam) = $idInput Then InputFormated() Return "GUI_RUNDEFMSG" EndFunc ;==>_WM_COMMAND Deye
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