Jump to content

_guictrllistviewgetseletedindicies


Aceguy
 Share

Recommended Posts

Just did a quick modification to the help file so that i can change the selected list, rather than the one preset in the _guictrllistviewsetitemtext, and it wont work.

Any ideas please

#include <GuiConstants.au3>
#include <GuiListView.au3>


opt('MustDeclareVars', 1)
Dim $listview, $Btn_SetItem0, $Btn_Exit, $msg, $Status, $ret, $Btn_SetSub1
GUICreate("ListView Set Item Text", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER), BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_REGIONAL))
GUICtrlCreateListViewItem("index 0|data1|more1", $listview)
GUICtrlCreateListViewItem("index 1|data2|more2", $listview)
GUICtrlCreateListViewItem("index 2|data3|more3", $listview)
GUICtrlCreateListViewItem("index 3|data4|more4", $listview)
GUICtrlCreateListViewItem("index 4|data5|more5", $listview)
_GUICtrlListViewSetColumnWidth ($listview, 0, 100)
$Btn_SetItem0 = GUICtrlCreateButton("Set 2 Item", 150, 200, 120, 40)
$Btn_SetSub1 = GUICtrlCreateButton("Set 2 SubItem", 150, 250, 120, 40)
$Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30)
$Status = GUICtrlCreateLabel("", 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))

GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
            ExitLoop
        Case $msg = $Btn_SetItem0
            $test=_GUICtrlListViewGetSelectedIndices($listview)
            _GUICtrlListViewSetItemText ($listview,$test, 0, "Testing")
        Case $msg = $Btn_SetSub1
            _GUICtrlListViewSetItemText ($listview,2, 1, "Sub")
    EndSelect
WEnd
Exit

Many thanks

Link to comment
Share on other sites

ok, got it working

_GUICtrlListViewSetItemText($listview,0+$test,0,"Test")

odd, but it works

I think your problem is not so odd

$test=_GUICtrlListViewGetSelectedIndices($listview);<--- $test is a string of pipe delimited items

_GUICtrlListViewSetItemText ($listview,$test, 0, "Testing");<- but here $test should be an integer for the index

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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