Jump to content

Recommended Posts

Posted (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 process

Func 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.
EndFunc

If 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_NOTIFY

If $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
EndIf

Thank you.

Edited by MPHillier

I Break and Fix things... If the surf is up I'm outta here.....

  • Moderators
Posted

MPHillier,

Does this help at all? :oops:

#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. :bye:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted

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 - string

To 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
Posted

MPHillier,

You have understood it correctly. :oops:

Good luck with the project. :bye:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...