Jump to content

SOLVED - Create combo box with dropdown that is not bound by width


 Share

Recommended Posts

I'm trying to figure out if it is possible to make the dropdown that pops out of the combo box not be limited to the width of the combo box itself. So for example say the combo box is 50 wide and the text is 60 wide, I'd like to show the combobox as 50 wide in the gui, but when I select the dropdown, it sizes the dropdown based on the text in it.

I do not want the combo box to change size but I also don't want the text to be editable. I've tried a few various different combinations to try to get this work and they all keep re-sizing the combobox itself.

Any suggestions?

Edited by Jewtus
Link to comment
Share on other sites

  • Moderators

Jewtus,

Easy - wait for the dropdown to appear and then resize it - this is based on the _GUICtrlComboBox_GetComboBoxInfo example in the Help file:

#include <GuiComboBox.au3>
#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>

Global $g_idMemo



Example()

Func Example()
    Local $tInfo, $idCombo



    ; Create GUI
    GUICreate("ComboBox Get ComboBox Info", 400, 296)
    $idCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
    $g_idMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
    GUICtrlSetFont($g_idMemo, 9, 400, 0, "Courier New")
    GUISetState(@SW_SHOW)

    ; Add files
    _GUICtrlComboBox_BeginUpdate($idCombo)
    _GUICtrlComboBox_AddDir($idCombo, @WindowsDir & "\*.exe")
    _GUICtrlComboBox_EndUpdate($idCombo)

    If _GUICtrlComboBox_GetComboBoxInfo($idCombo, $tInfo) Then
        $hCombo = DllStructGetData($tInfo, "hCombo")
        $hEdit = DllStructGetData($tInfo, "hEdit")
        $hList = DllStructGetData($tInfo, "hList")
    EndIf



    ; Loop until the user exits.
    Do

        If _GUICtrlComboBox_GetDroppedState($idCombo) = True Then
            $aWPos = WinGetPos($hList)
            WinMove($hList, "", $aWPos[0], $aWPos[1], 500)
        EndIf





    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>Example

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

 

Link to comment
Share on other sites

Not sure I fully understand what is going on here, but I have some other tasks to finish prior to putting these polishes on the GUI. I'll look back at this when I have a bit more time to play with (I was hoping it was an extended style or something).

 

Thanks Melba!

Link to comment
Share on other sites

  • Moderators

KaFu,

You got me!

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

 

Link to comment
Share on other sites

  • Moderators

Jewtus,

Not in this version of the new forum software.  IPS have received a number of requests to restore the functionality, but believe me there are many more pressing problems they need to address first!

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

 

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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