Sign in to follow this  
Followers 0
htclub

Gui list view ?

7 posts in this topic

note: sorry , If I type English wrong because my English is poor

Help me

I want to creat list view and 4 button (add,remove,up,down)

click add: add item to listview

click remove: remove selected item from listview

click up: move item from listview up

click down: move item from listview down

Share this post


Link to post
Share on other sites



Firs, you can use Koda Formdesigner to design the requested form. Do that first, and then select generate code with options. Select use variables where possible and something like create functions (not sure about last one)

post that code here and we'll help you with what autoit functions are best to use for you.

Remember, we are NOT going to write the exact code for you.


[right]~What can I say, I'm a Simplistic person[/right]

Share this post


Link to post
Share on other sites

Koda Formdesigner can creat gui (code can make gui)

but i need code to if i click:

click add: add item to listview

click remove: remove selected item from listview

click up: move item from listview up

click down: move item from listview down

Share this post


Link to post
Share on other sites

I wrote this example with add and del functions to show you how can you do what you want:

Global $ITEM[1]
$ITEM[0] = 0
Global $LISTVIEW
$GUI = GUICreate("EXAMPLE",400,200)
$LISTVIEW = GUICtrlCreateListView("COL1|COL2|COL3|COL4",5,5,200,190,BitOR(0x00100000,0x00200000))
$ADD = GUICtrlCreateButton("Add",250,5,100,20)
$DEL = GUICtrlCreateButton("Delete",250,30,100,20)
GUISetState(@SW_SHOW,$GUI)

While 1
    $MSG = GUIGetMsg()
    Select
        Case $MSG = $ADD
            Call("Add")
        Case $MSG = $DEL
            Call("Del")
        Case $MSG = -3
            Exit
    EndSelect
    Sleep(15)
WEnd

Func Add()
    $ADD_GUI = GUICreate("ADD",150,130,-1,-1,0x16C80000,0x00000189)
    $ITEM1 = GUICtrlCreateInput("TEXT1",5,5,140,20,0x01)
    $ITEM2 = GUICtrlCreateInput("TEXT2",5,30,140,20,0x01)
    $ITEM3 = GUICtrlCreateInput("TEXT3",5,55,140,20,0x01)
    $ITEM4 = GUICtrlCreateInput("TEXT4",5,80,140,20,0x01)
    $ADD_BUTTON = GUICtrlCreateButton("ADD",50,105,50,20)
    GUISetState(@SW_SHOW,$ADD_GUI)
    While 1
        $ADD_MSG = GUIGetMsg()
        If $ADD_MSG = $ADD_BUTTON Then
            $TEXT = GUICtrlRead($ITEM1) & "|" & GUICtrlRead($ITEM2) & "|" & GUICtrlRead($ITEM3) & "|" & GUICtrlRead($ITEM4)
            GUIDelete($ADD_GUI)
            ReDim $ITEM[UBound($ITEM)+1]
            $ITEM[UBound($ITEM)-1] = GUICtrlCreateListViewItem($TEXT,$LISTVIEW)
            ExitLoop
        EndIf
        Sleep(20)
    WEnd
EndFunc

Func Del()
    If GUICtrlRead($LISTVIEW)-5 > 0 Then
        GUICtrlDelete($ITEM[GUICtrlRead($LISTVIEW)-5])
    EndIf
EndFunc

Hope that helps. :mellow:


When the words fail... music speaks

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

how can move item up or down

Edited by htclub

Share this post


Link to post
Share on other sites

how can move item up or down

_GUICtrlListView_DeleteItem()
_GUICtrlListView_InsertItem()

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