Jewtus

Move all listview items

4 posts in this topic

#1 ·  Posted (edited)

I'm working on a UI with add 1 and add all buttons. This is some example code:

$gui=GUICreate("Selector", 951, 268, 192, 114)
    $Label1 = GUICtrlCreateLabel("Not Marked", 8, 6, 58, 17)
    $Label2 = GUICtrlCreateLabel("Marked", 504, 6, 81, 17)
    Global $idlvMarked= GUICtrlCreateListView("", 496, 24, 450, 198)
    _GUICtrlListView_RegisterSortCallBack($idlvMarked)
    $btnAdd1 = GUICtrlCreateButton(">", 459, 24, 27, 25)
    $btnAddAll = GUICtrlCreateButton(">>", 459, 49, 27, 25)
    Global $idlvNotMarked  = GUICtrlCreateListView("", 0, 24, 450, 198)
    _GUICtrlListView_RegisterSortCallBack($idlvNotMarked)
    $btnRemove1 = GUICtrlCreateButton("<", 459, 193, 27, 25)
    $btnRemoveAll = GUICtrlCreateButton("<<", 459, 168, 27, 25)
    $btnUpdate = GUICtrlCreateButton("Update", 448, 232, 51, 25)
    GUICtrlSetState($btnProjectEdit,$GUI_DISABLE)
    GUISetState(@SW_SHOW)
    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                GUIDelete($gui)
                ExitLoop
            Case $btnAdd1
                $sProjectID=StringSplit(_GUICtrlListView_GetItemTextString($idlvNotMarked),"|")[1]
                If $sProjectID<> "" Then _GUICtrlListView_CopyItems($idlvNotMarked,$idlvMarked,True)
            Case $btnAddAll
                $sProjectID=StringSplit(_GUICtrlListView_GetItemTextString($idlvNotMarked),"|")[1]
;????????????
            Case $btnRemove1
                $sProjectID=StringSplit(_GUICtrlListView_GetItemTextString($idlvMarked),"|")[1]
                If $sProjectID<> "" Then _GUICtrlListView_CopyItems($idlvMarked,$idlvNotMarked,True)
        EndSwitch
    WEnd

Anyone have any clever ideas on how to do this in a simple way?

Edited by Jewtus

Share this post


Link to post
Share on other sites



Maybe use an INI file? Adding 1 will add a new key, adding all will add the entire section?


MCR.jpg?t=1286371579

Most recent sig. I made

Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic

Share this post


Link to post
Share on other sites

Not sure I understand what you mean. I was thinking about locking the GUI so its no repainting and then do a Do statement that moves (select then fire the same command) the first record until there are no more records then unlock the GUI, but that seemed inefficient.

Share this post


Link to post
Share on other sites

This is what I did:

GUISetState($GUI,@SW_LOCK)
                $aMover=_GUICtrlListView_CreateArray($idlvNotMarked)
                _ArrayDelete($aMover,0)
                _GUICtrlListView_AddArray($idlvMarked,$aMover)
                _GUICtrlListView_DeleteAllItems($idlvNotMarked)
                $aMover=""
                GUISetState($PSMGUI,@SW_UNLOCK)

I used @guinness _GUICtrlListView_CreateArray to grab everything and move it.

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