Jump to content

Recommended Posts

Posted

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

Posted (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 by Deye
  • Moderators
Posted

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted (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 by mikell
Posted

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

#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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...