Jump to content
Sign in to follow this  
ozmike

multi column combo boxes autoit

Recommended Posts

ozmike

Can we do multi column combo boxes - and hide columns

I want to have data in a combo

ABC "www.yyy.com"

DEF "www.jjj.com"

I want to show the below - i want to hide column 2 eg.

ABC

DEF

I want to do this so that i don't have to maintain a separate 2d

array

- I know you can do this with list views but what about combos..

mike

Share this post


Link to post
Share on other sites
Yoriz

You could do it like this.

#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $aComboContents[2] = ["ABC www.yyy.com","DEF www.jjj.com"]

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 261, 122, -1, -1)
$Combo1 = GUICtrlCreateCombo("", 58, 50, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
For $i = 0 To UBound($aComboContents)-1 Step 1
    $aComboPart = StringSplit($aComboContents[$i], " ")
    GUICtrlSetData(-1, $aComboPart[1], $aComboPart[1])
Next
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Combo1
            $sText = GUICtrlRead($Combo1)
            For $i = 0 To UBound($aComboContents)-1 Step 1
                $aComboPart = StringSplit($aComboContents[$i], " ")
                If $aComboPart[1] = $sText Then
                    MsgBox(0, "Selected", $aComboPart[2])
                    ExitLoop
                EndIf
            Next
    EndSwitch
WEnd
Edited by Yoriz

GDIPlusDispose - A modified version of GDIPlus that auto disposes of its own objects before shutdown of the Dll using the same function Syntax as the original.EzMySql UDF - Use MySql Databases with autoit with syntax similar to SQLite UDF.

Share this post


Link to post
Share on other sites
ozmike

Thanks that solution work..

I was hoping there was such a control ..like in msaccess ..but your solution works..

I'll have to check out KODA..

Share this post


Link to post
Share on other sites
spudw2k

You can also use the _GUICtrlComboBoxEx_SetItemParam/_GUICtrlComboBoxEx_GetItemParam functions, but they do not display the second value in the combox either.

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.