Sign in to follow this  
Followers 0
slayerz

List View example needed

4 posts in this topic

Hi everyone... I'd never use GUICtrlCreateListView before, so I need your help guys.

How to display a list from text file?

Let say I have file : item.ini

[item1]

date= 11:45 AM 27/6/2008

item = Kingston Data Traveller 2.0 Device

status = Good

#include <GUIConstantsEx.au3>
#include <ListviewConstants.au3>

Opt("GUIOnEventMode", 1)

$GUI = GUICreate("Demo", 693, 230)
GUISetBkColor(0xFFFBF0)
GUISetOnEvent($GUI_EVENT_CLOSE, "GUIClose")

$threatlist = GUICtrlCreateListView("Date/Time|Item Description|Condition", 9, 9, 675, 165, Default, BitOR($LVS_EX_GRIDLINES,$LVS_EX_FULLROWSELECT,$LVS_EX_CHECKBOXES))
GUICtrlSendMsg(-1, 0x101E, 0, 160)
GUICtrlSendMsg(-1, 0x101E, 1, 310)
GUICtrlSendMsg(-1, 0x101E, 2, 200)

; How to convert this part, to get the data from the file and display it in ListView?
$item1 = GUICtrlCreateListViewItem("11:45 AM 27/6/2008|Kingston Data Traveller 2.0 Device|Good", $threatlist)
$item2 = GUICtrlCreateListViewItem("1:45 PM 27/6/2008|External Hardisk|Good", $threatlist)
$item3 = GUICtrlCreateListViewItem("3:45 PM 27/6/2008|MP4 Player|Poor", $threatlist)

GUISetState(@SW_SHOW)

;Unfinished...
$Button1 = GUICtrlCreateButton("Delete", 88, 180, 64, 48, 0)
$Button2 = GUICtrlCreateButton("Clear", 416, 180, 64, 48, 0)

While 1
    Sleep(100)
WEnd

Func GUIClose()
    Exit
EndFunc

AUTOIT[sup] I'm lovin' it![/sup]

Share this post


Link to post
Share on other sites



Const $IniFile = "item.ini"
Dim $I, $LVItmTxt
For $I = 1 to 100 ; Increase if you have more items
     $LVItmTxt = IniRead($IniFile, "Item" & $I, "date")
     If @error Then ExitLoop
     If StringLen($Txt) < 1 Then ExitLoop ; No More
     $LVItmTxt &=  "|" & IniRead($IniFile, "Item" & $I, "item", "")
     $LVItmTxt &=  "|" & IniRead($IniFile, "Item" & $I, "status", "")
     GUICtrlCreateListViewItem($LVItmTxt, $threatlist)
Next ;$I

Share this post


Link to post
Share on other sites

Const $IniFile = "item.ini"
Dim $I, $LVItmTxt
For $I = 1 to 100 ; Increase if you have more items
     $LVItmTxt = IniRead($IniFile, "Item" & $I, "date")
     If @error Then ExitLoop
     If StringLen($Txt) < 1 Then ExitLoop ; No More
     $LVItmTxt &=  "|" & IniRead($IniFile, "Item" & $I, "item", "")
     $LVItmTxt &=  "|" & IniRead($IniFile, "Item" & $I, "status", "")
     GUICtrlCreateListViewItem($LVItmTxt, $threatlist)
Next ;$I
thanks for the reply...I'll try yours

AUTOIT[sup] I'm lovin' it![/sup]

Share this post


Link to post
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
Sign in to follow this  
Followers 0