Jump to content

insert from list1 to list2


ShadowElf
 Share

Recommended Posts

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

Link to comment
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

Link to comment
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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...