Xink Posted September 24, 2007 Share Posted September 24, 2007 Hello, Is it possible to enable the control key to select multiple entries in de GUICtrlCreateList? I have noticed the control key is working with GUICtrlCreateListView. Any help are appreciated Xink Link to comment Share on other sites More sharing options...
GaryFrost Posted September 24, 2007 Share Posted September 24, 2007 #include <GUIConstants.au3> #include <GuiList.au3> Opt ('MustDeclareVars', 1) Dim $msg, $ret, $listbox, $button, $i GUICreate("ListBox Selected Items Indices Demo", 400, 250, -1, -1) $listbox = GUICtrlCreateList("", 125, 40, 180, 120, BitOR($LBS_SORT, $WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY, $LBS_MULTIPLESEL)) GUICtrlSetData($listbox, "test1|more testing|even more testing|demo|") $button = GUICtrlCreateButton("Get Selected", 150, 160, 120, 40) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $button $ret = _GUICtrlListGetSelItems ($listbox) If (Not IsArray($ret)) Then MsgBox(16, "Error", "Unknown error from _GUICtrlListGetSelItems") Else For $i = 1 To $ret[0] MsgBox(0, "Selected", $ret[$i]) Next EndIf EndSelect WEnd SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Xink Posted September 24, 2007 Author Share Posted September 24, 2007 Thank you for your reply. Sorry i am not clear at the first time. I want to select multiple items with the Ctrl key and not with the mouse. The mouse can select only one item. Is this possible? Link to comment Share on other sites More sharing options...
Richard Robertson Posted September 24, 2007 Share Posted September 24, 2007 The only way to select items is with the mouse. You hold control and click more than one item. As long as the $LBS_MULTIPLESEL is used, you can click more than one, as long as you hold control. Link to comment Share on other sites More sharing options...
Xink Posted September 24, 2007 Author Share Posted September 24, 2007 The only way to select items is with the mouse. You hold control and click more than one item. As long as the $LBS_MULTIPLESEL is used, you can click more than one, as long as you hold control.If you not hold down the Ctrl key, you still can select multiple items with the mouse.I only want to selected multiple items with the Ctrl key, if Ctrl key is not hold down, only 1 item can selected.See GUICtrlCreateListView, this is exactly what i want, but now in GUICtrlCreateList. Link to comment Share on other sites More sharing options...
Siao Posted September 24, 2007 Share Posted September 24, 2007 Use $LBS_EXTENDEDSEL (0x800) "be smart, drink your wine" Link to comment Share on other sites More sharing options...
Xink Posted September 25, 2007 Author Share Posted September 25, 2007 Use $LBS_EXTENDEDSEL (0x800)How do i use $LBS_EXTENDEDSEL? i cannot found this in the help file.When i try this, it is not recognized. Variable used without being declared.GUICtrlCreateList("", 424, 359, 339, 201, BitOR($LBS_SORT,$LBS_STANDARD,$LBS_EXTENDEDSEL,$WS_VSCROLL,$WS_BORDER)) Link to comment Share on other sites More sharing options...
Siao Posted September 25, 2007 Share Posted September 25, 2007 When i try this, it is not recognized. Variable used without being declared.So declare it. Global Const $LBS_EXTENDEDSEL = 0x800 ... ... GUICtrlCreateList("", 424, 359, 339, 201, BitOR($LBS_SORT,$LBS_STANDARD,$LBS_EXTENDEDSEL,$WS_VSCROLL,$WS_BORDER)) Or don't declare, just plug it's value into GUICtrlCreateList() directly, if you don't care about readability of your code... GUICtrlCreateList("", 424, 359, 339, 201, BitOR($LBS_SORT,$LBS_STANDARD,0x800,$WS_VSCROLL,$WS_BORDER)) "be smart, drink your wine" Link to comment Share on other sites More sharing options...
Xink Posted September 25, 2007 Author Share Posted September 25, 2007 Thank you very much, it works Link to comment Share on other sites More sharing options...
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