Jump to content
Sign in to follow this  

Hi, I need help with GUICtrlListView

Recommended Posts


Hi guys,

I'm looking for some help.

I want to create something like database, using _GUICtrlListView_AddItem etc.etc.

I've created a simple table with colums and rows but dont have any idea how to make all fields editable from GUI; for example row. 4 column 1 edit to any text. That means: User is double clicking somewhere in that table and he is able to change record.

I was analyzing _GUICtrlListView_EditLabel in AutoIt Help but i dont know how to use that properly. I got some problems with it.

And the second thing: i wanna copy the text from these fields (fe. edited: Row 5: Col 3 --> Good Morning!) and save it with IniWrite command to the .ini file. Is it possible? :D

Here's my code:

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work


Func _Main()
    Local $hImage, $hListView

    GUICreate("ListView Add SubItem", 400, 300)
    $hListView = GUICtrlCreateListView("", 3, 3, 394, 268, -1, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES))
    _GUICtrlListView_SetUnicodeFormat($hListView, False)
    $hImage = _GUIImageList_Create()
    _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0xFF0000, 16, 16))
    _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0x00FF00, 16, 16))
    _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0x0000FF, 16, 16))
    _GUICtrlListView_SetImageList($hListView, $hImage, 1)

    ; Add columns
    _GUICtrlListView_InsertColumn($hListView, 1, "Column 1", 100)
    _GUICtrlListView_InsertColumn($hListView, 2, "Column 2", 100)
    _GUICtrlListView_InsertColumn($hListView, 3, "Column 3", 100)
    _GUICtrlListView_InsertColumn($hListView, 4, "Column 4", 100)

    ; Add items
    _GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 1)
    _GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
    _GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 1)
    _GUICtrlListView_AddItem($hListView, "Row 4: Col 1", 1)
    _GUICtrlListView_AddItem($hListView, "Row 5: Col 1", 1)
    _GUICtrlListView_AddItem($hListView, "Row 6: Col 1", 1)
    _GUICtrlListView_AddItem($hListView, "Row 7: Col 1", 1)
    _GUICtrlListView_AddItem($hListView, "Row 8: Col 1", 1)
    _GUICtrlListView_AddItem($hListView, "Row 9: Col 1", 1)
    _GUICtrlListView_AddItem($hListView, "Row 10: Col 1", 1)
    _GUICtrlListView_AddItem($hListView, "Row 11: Col 1", 1)
    _GUICtrlListView_AddItem($hListView, "Row 12: Col 1", 1)
    _GUICtrlListView_AddItem($hListView, "Row 13: Col 1", 1)
    _GUICtrlListView_AddSubItem($hListView,0, "Row 1: Col 2",1,0)
    _GUICtrlListView_AddSubItem($hListView,1, "Row 2: Col 2",1,0)
    _GUICtrlListView_AddSubItem($hListView,2, "Row 3: Col 2",1,0)
    _GUICtrlListView_AddSubItem($hListView,3, "Row 4: Col 2",1,0)
    _GUICtrlListView_AddSubItem($hListView,4, "Row 5: Col 2",1,0)
    _GUICtrlListView_AddSubItem($hListView,5, "Row 6: Col 2",1,0)
    _GUICtrlListView_AddSubItem($hListView,0, "Row 1: Col 3",2,2)
    _GUICtrlListView_AddSubItem($hListView,1, "Row 2: Col 3",2,2)
    _GUICtrlListView_AddSubItem($hListView,2, "Row 3: Col 3",2,2)
    _GUICtrlListView_AddSubItem($hListView,3, "Row 4: Col 3",2,2)
    _GUICtrlListView_AddSubItem($hListView,4, "Row 5: Col 3",2,2)
    _GUICtrlListView_AddSubItem($hListView,5, "Row 6: Col 3",2,2)
    _GUICtrlListView_AddSubItem($hListView,6, "Row 7: Col 3",2,2)
    _GUICtrlListView_AddSubItem($hListView,7, "Row 8: Col 3",2,2)
    _GUICtrlListView_AddSubItem($hListView,0, "Row 1: Col 4",3,2)
    _GUICtrlListView_AddSubItem($hListView,1, "Row 2: Col 4",3,2)
    _GUICtrlListView_AddSubItem($hListView,2, "Row 3: Col 4",3,2)
    _GUICtrlListView_AddSubItem($hListView,3, "Row 4: Col 4",3,2)
    _GUICtrlListView_AddSubItem($hListView,4, "Row 5: Col 4",3,2)
    _GUICtrlListView_AddSubItem($hListView,5, "Row 6: Col 4",3,2)
    _GUICtrlListView_AddSubItem($hListView,6, "Row 7: Col 4",3,2)
    _GUICtrlListView_AddSubItem($hListView,7, "Row 8: Col 4",3,2)
    _GUICtrlListView_AddSubItem($hListView,8, "Row 9: Col 4",3,2)
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

ISO help :huggles:


Share this post

Link to post
Share on other sites

What you need to do is detect double clicks on an item in the list view. The help file example for _GUICtrlListView_EditLabel shows that you can do that with WM_NOTIFY. Then, when detected, you call _GUICtrlListView_EditLabel with the handle to the control and the index of the item that was double clicked as parameters.

[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.