Sign in to follow this  
Followers 0
ShadowElf

insert from list1 to list2

7 posts in this topic

If i have a list

$Form1_1 = GUICreate("ShadowPOS", 801, 601, 217, 156)
$List1 = GUICtrlCreateListView("Codbar|Produs", 22, 120, 553, 260)
GUICtrlCreateListViewItem("asd|asd", $list1)
GUICtrlCreateListViewItem("fds|fdsdsf", $list1)
GUICtrlCreateListViewItem("asdasd|fdsdsf", $list1)

$List2 = GUICtrlCreateListView("Codbar|Produs", 1, 2, 3, 6)
$insert = GUICtrlCreateButton("INSERT", 505, 470, 65, 57)

How to insert a item from list1 in list2?

thx


I like IT: php, mysql, codeingiter, css, jquery and AUTOIT

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Look into "C:\Program Files\AutoIt3\autoit.chm" 

at User Defined Functions/GuiListView Management

_GUICtrlListView_GetItemCount

_GUICtrlListView_GetItemText

_GUICtrlListView_InsertItem

...

Edited by Zedna

Share this post


Link to post
Share on other sites

Look into "C:\Program Files\AutoIt3\autoit.chm" 

at User Defined Functions/GuiListView Management

_GUICtrlListView_GetItemCount

_GUICtrlListView_GetItemText

_GUICtrlListView_InsertItem

...

thx, that i understand

but from list 1 I must slect 1 item and insert into the second list when I press a buton. How i get the "selected" item id?


I like IT: php, mysql, codeingiter, css, jquery and AUTOIT

Share this post


Link to post
Share on other sites

Look up _GUICtrlListView_GetSelectedIndices() in the help file.

Share this post


Link to post
Share on other sites

This is what you need:

#include <GUIConstantsEx.au3>
#include<GUIlistview.au3>
$Form1_1 = GUICreate("ShadowPOS", 801, 601, 217, 156)
$List1 = GUICtrlCreateListView("Codbar|Produs", 22, 120, 300, 260,"",$LVS_EX_CHECKBOXES)
GUICtrlCreateListViewItem("asd|asdsub", $list1)
GUICtrlCreateListViewItem("fds|fdsdsf", $list1)
GUICtrlCreateListViewItem("asdasd|fdsdsf", $list1)

$List2 = GUICtrlCreateListView("Item1|Item2", 350, 120, 300, 260)
$insert = GUICtrlCreateButton("INSERT", 505, 470, 65, 57)

guisetstate(@sw_show)
while 1
    $msg=GUIGetMsg()
    Switch $msg
    Case $gui_event_close
        Exit
    Case $insert
        For $i=0 to _GUICtrlListView_GetItemCount($List1)
        If _GUICtrlListView_GetItemChecked($List1,$i) Then
            $c=_GUICtrlListView_GetItemCount($List2)
            _GUICtrlListView_AddItem($List2,_GUICtrlListView_GetItemText($List1,$i,0))
            _GUICtrlListView_AddSubItem($List2,$c,_GUICtrlListView_GetItemText($List1,$i,1),1)
        EndIf
        Next
    EndSwitch
    WEnd

[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

Share this post


Link to post
Share on other sites

thx all, it works


I like IT: php, mysql, codeingiter, css, jquery and AUTOIT

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