Jump to content

Recommended Posts

Posted

Hi guys, i have some problem to make the output of a _GUICtrlListView_Create:

#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>
$Number = 0
_Main()
Func _Main()
Local $GUI, $hImage
$GUI = GUICreate("(UDF Created) ListView Create", 400, 300)
$hListView = _GUICtrlListView_Create($GUI, "", 2, 2, 394, 268)
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES))
GUISetState()
_GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 100)
_GUICtrlListView_InsertColumn($hListView, 1, "Column 2", 100)
_GUICtrlListView_InsertColumn($hListView, 2, "Column 3", 100)
_GUICtrlListView_AddItem($hListView, "1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Item1", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Item2", 2)
_GUICtrlListView_AddItem($hListView, "2", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Item1 - Line 2", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Item1 - Line 2", 2)
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()

I have make an script like this:

$List = FileOpen(@WorkingDir & "\test.txt", 2)
  $Number_items = _GUICtrlListView_GetItemCount($hListView)
   For $i = 0 To $Number_items - 1 Step +1
    $read = _GUICtrlListView_GetItemTextArray($hListView, $i)
    _FileWriteFromArray($List, $read, 1)
   Next
  FileClose($List)

On the txt the layout is:

1
Item1
Item2
2
Item1 - Line 2
Item1 - Line 2

But i want a layout like:

1 - Item1 - Item2
2 - Item1 - Line 2 - Item1 - Line 2

Some advice?

Thanks

Posted

$List = FileOpen(@WorkingDir & "test.txt", 2)
  $Number_items = _GUICtrlListView_GetItemCount($hListView)
   For $i = 0 To $Number_items - 1 Step +1
    $read = StringReplace(_GUICtrlListView_GetItemTextString($hListView, $i),"|", " - ")
    FileWriteLine($List, $read)
   Next
  FileClose($List)

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
×
×
  • Create New...