Burgaud Posted April 8, 2018 Share Posted April 8, 2018 Below is a slightly modified example from the GUICtrlRead help: #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Example() Func Example() GUICreate("My GUICtrlRead") ; will create a dialog box that when displayed is centered Local $idList = GUICtrlCreateList("", 10, 10, 200, 300, 0x1000) GUICtrlSetData(-1, "dog|dog|dog|cat|dog|cat|cat|dog|cat|cat", "dog") Local $idButton = GUICtrlCreateButton("Read", 10, 350, 50) GUICtrlSetState(-1, $GUI_FOCUS) ; the focus is on this button GUISetState(@SW_SHOW) ; will display an empty dialog box Local $idMsg, $iMenustate, $sMenutext ; Loop until the user exits. Do $idMsg = GUIGetMsg() If $idMsg = $idButton Then $selected = GUICtrlRead($idList, 0) $extended = GUICtrlRead($idList, 1) MsgBox($MB_SYSTEMMODAL, "Selected", "Selected:" & $selected & @CRLF & "Extended:"&$extended) ; display the selected listbox entry EndIf Until $idMsg = $GUI_EVENT_CLOSE EndFunc ;==>Example If my list contains multiple occurance of the same word, in the above example: dog and cat appearing multiple times, sorted or not, how can I determine if the user selected the 1st DOG or the 3rd DOG instance? Is there a way to get from GUICtrlRead a number pertaining to the order of the selected item? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 8, 2018 Moderators Share Posted April 8, 2018 Burgaud, _GUICtrlListBox_GetSel should provide the required information. But if all the items are the same why does it matter which one is selected? M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Burgaud Posted April 8, 2018 Author Share Posted April 8, 2018 M23, What I am trying to do is something like this: I got an array of NAMES. This goes into List#1 Each name corresponds to an ADDRESS that goes into LIST#2 and TRANSACTION that goes into LIST#3 Able to determine if I am referring to first DOG, or 2nd DOG is important because transactions and address matters. Link to comment Share on other sites More sharing options...
jchd Posted April 8, 2018 Share Posted April 8, 2018 OK but then how do the user(s) choose between Joe, Joe and Joe appearing in the list? (This is just for my education) This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
Burgaud Posted April 8, 2018 Author Share Posted April 8, 2018 select joe, check address, until address and joe is person you are looking for. Link to comment Share on other sites More sharing options...
jchd Posted April 8, 2018 Share Posted April 8, 2018 Then why not list enough information in the ListView to make selection unambiguous, hence easier, faster and less prone to error? This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
Burgaud Posted April 8, 2018 Author Share Posted April 8, 2018 Am I reading that post correctly? You want to dump name and address into a single line per person for all persons inside a single List? I am not sure if that is how the phonebook works these days... must be the new norm for 2018.. Link to comment Share on other sites More sharing options...
jchd Posted April 8, 2018 Share Posted April 8, 2018 Then do how you want it to work. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 8, 2018 Moderators Share Posted April 8, 2018 Burgaud, I must say I agree with jchd - a ListView with some additional information to help the user make a choice would seem to be a much better way to go. And you could keep the other address and transaction data in hidden columns within the ListView, which would make the actual index chosen by the user completely moot. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
jchd Posted April 8, 2018 Share Posted April 8, 2018 Yes, that, insisting on "some additional information", not everything recorded for that person. I again apologize for posting a remark which doesn't directly answer your initial question. Another way to achieve such a selection in cases where the source is somehow big (e.g. a large phonebook): Create an input box and a listview (can be initially empty) Monitor the input and for each new character entered there, and display the plausible entries in the listview along some info (e.g. ZIP code ou city or something the user can easily check, depending on context). There are several examples in the forum for monitoring an inputbox on character basis and invoking a function every new char. After just 3 or so chars entered, the list begins to be very restrictive and workable. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 8, 2018 Moderators Share Posted April 8, 2018 Burgaud, An example of an "autocomplete" list which jchd mentioned above. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area 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