tittoproject Posted November 19, 2006 Posted November 19, 2006 (edited) I have a list made like that: $list = GUICtrlCreateList("List", 10, 10, -1, 100) GUICtrlSetData(-1, "Carlo|Carlo|Mario") Normally I use the command GUICtrlRead($list) to read the selected item, but, as two or more items have the same value, I want to know also its order. In the example, when I choose the value "Carlo", I want to know which "Carlo", the first or the second? Edited November 19, 2006 by tittoproject
Valuater Posted November 19, 2006 Posted November 19, 2006 maybe... #include <GUIConstants.au3> #include <GuiList.au3> Opt ('MustDeclareVars', 1) Dim $msg, $ret Dim $listbox, $label, $button GUICreate("ListBox Get Caret Index Demo", 400, 250, -1, -1) $listbox = GUICtrlCreateList("", 125, 40, 180, 120, BitOR($LBS_SORT, $WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY, $LBS_MULTIPLESEL)) GUICtrlSetData($listbox, "Carlo|Carlo|Mario") $button = GUICtrlCreateButton("Get Index", 150, 160, 120, 40) $label = GUICtrlCreateLabel("Item #", 150, 210, 120) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $button $ret = _GUICtrlListGetCaretIndex ($listbox) GUICtrlSetData($label, "Item : " & $ret) EndSelect WEnd 8)
/dev/null Posted November 19, 2006 Posted November 19, 2006 I have a list made like that: $list = GUICtrlCreateList("List", 10, 10, -1, 100) GUICtrlSetData(-1, "Carlo|Carlo|Mario") Normally I use the command GUICtrlRead($list) to read the selected item, but, as two or more items have the same value, I want to know also its order. In the example, when I choose the value "Carlo", I want to know which "Carlo", the first or the second? take a look at _GUICtrlListGetSelItems and the _GUICtrlList* UDF functions in general. Cheers Kurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *
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