MPHillier Posted March 4, 2012 Posted March 4, 2012 (edited) EDIT - initially had incorrect line...Corrected.Ok, Listview has 5 columns Username,Computername,Timein,Date,Serial. Thought process is to use _GUICtrlListView_GetItemTextString($hListView) to get specific row and take each column input and place each into its own Input box. Then run specific commands off these input boxes.I was looking at an example and it was used to split the listview and place into new excel file - thought I could do the same to get my needed results. Yet of course I am not getting to get the divided info into the separate input boxes.Here is my thought processFunc ListInput() $iItems = [color=#ff0000]_GUICtrlListView_GetItemTextString[/color]($hListView, 1)) ;EDIT - initially had incorrect line...Corrected.[/color] For $iItem = 0 To $iItems - 1 $Zf = StringSplit($Zf, "|", 1) ;<<<<<<<<<<<<<<<<<<<<<<<< Take string and place into individual input boxes. EndFuncIf you could point me to an example or another help file to help me work this out I would greatly appreciate it or am I coming at this from a wrong point of view....?I can get the first columns selected input using $WM_NOTIFYIf $fDblClk = True Then $sText = GUICtrlRead($hListView) - 18 ; Read the item GUICtrlSetData($LCount, "List Item: " & $sText) Local $OutPut = _GUICtrlListView_GetItemText($hListView, $sText) GUICtrlSetData($iUserName, $OutPut) $fDblClk = False; Reset the flag EndIfThank you. Edited March 4, 2012 by MPHillier I Break and Fix things... If the surf is up I'm outta here.....
Moderators Melba23 Posted March 4, 2012 Moderators Posted March 4, 2012 MPHillier, Does this help at all? expandcollapse popup#include <GUIConstantsEx.au3> #include <GuiListView.au3> Global $aInput[5] $hGUI = GUICreate("Test", 500, 500) $cListView = GUICtrlCreateListView("", 10, 10, 480, 300) _GUICtrlListView_AddColumn($cListView, "Username", 80) _GUICtrlListView_AddColumn($cListView, "Computername", 80) _GUICtrlListView_AddColumn($cListView, "Timein", 80) _GUICtrlListView_AddColumn($cListView, "Serial", 80) _GUICtrlListView_AddColumn($cListView, "Date", 80) For $i = 1 To 10 GUICtrlCreateListViewItem("User " & $i & "|Comp " & $i & "|Time " & $i & "|Serial " & $i & "|Date " & $i, $cListView) Next For $i = 0 To 4 $aInput[$i] = GUICtrlCreateInput("", 10, 350 + (30 * $i), 200, 20) Next $cButton = GUICtrlCreateButton("Extract", 300, 350, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cButton $iIndex = Number(_GUICtrlListView_GetSelectedIndices($cListView)) $sText = _GUICtrlListView_GetItemTextString($cListView) $aText = StringSplit($sText, "|", 2) For $i = 0 To 4 GUICtrlSetData($aInput[$i], $aText[$i]) Next EndSwitch WEnd I have used a button rather than a double-click message handler to save time, but the code is essentially the same. Please ask if you have any questions. 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
MPHillier Posted March 4, 2012 Author Posted March 4, 2012 This is cool -To my understanding - breaking it down -Get index of row being used $iIndex = Number(_GUICtrlListView_GetSelectedIndices($cListView))Get text from index\row $sText = _GUICtrlListView_GetItemTextString($cListView)Split data using "|" as the delimiter, flag = 2, disable the return count in the first element - effectively makes the array 0-based. $aText = StringSplit($sText, "|", 2)Drop into the inputs 0 - 4 For $i = 0 To 4 GUICtrlSetData($aInput[$i], $aText[$i]);Input box - stringTo actually break it down clears up so much for understanding whats going on.This is opening up other ideas to use in the project.So much Thanks and Aloha! I Break and Fix things... If the surf is up I'm outta here.....
Moderators Melba23 Posted March 4, 2012 Moderators Posted March 4, 2012 MPHillier, You have understood it correctly. Good luck with the project. 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
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