Sign in to follow this  
Followers 0
SLU5H

List box

3 posts in this topic

Hi,... :D

I need some help for ListBox. If I want to add items from list1 to list2, Its working pretty good! But, when I want remove one (choosen) item from list2, I can't realize it ... :evil:

Also:

#include <GUIConstants.au3>
$list = ProcessList()

$main3=GUICreate("Process-administrator",450,200) 
        GUICtrlCreateLabel("Running Processes:", 10,5,100,20)
        $list1=GUICtrlCreateList ("procesy_1", 10,20,180,160)
        for $i = 1 to $list[0][0]
            GUICtrlSetData(-1,$list[$i][0])
        next
        GUICtrlCreateLabel("Choosen Processes:", 250,5,100,20)
        $list2=GUICtrlCreateList ("procesy_2", 250,20,180,160)
        GUICtrlSetData(-1,"")
       
        $btn_add=GUICtrlCreateButton("add", 200,50,40,20)
        $btn_remove=GUICtrlCreateButton("remove", 200,90,40,20)
        GUISetState()
        
 While 1 
        $msg=Guigetmsg()
        select
        
        case $msg=$GUI_EVENT_CLOSE 
        exit
        
        case $msg=$btn_add
     
        GuiCtrlSetData($list2, GuiCtrlRead($list1))
        case $msg=$btn_remove
       ;??
             
 EndSelect  
WEnd

Thanks for any help/pointers! ........:)

Share this post


Link to post
Share on other sites



Requires Beta Version

;;;beta v.3.1.1.48
#include <GUIConstants.au3>
#Include <GuiList.au3>              ;;added


$list = ProcessList()

$main3 = GUICreate("Process-administrator",450,200)
        GUICtrlCreateLabel("Running Processes:", 10,5,100,20)
        $list1=GUICtrlCreateList ("procesy_1", 10,20,180,160)
        
        for $i = 1 to $list[0][0]
            GUICtrlSetData(-1,$list[$i][0])
        next
        GUICtrlCreateLabel("Choosen Processes:", 250,5,100,20)
        $list2=GUICtrlCreateList ("procesy_2", 250,20,180,160)
        GUICtrlSetData(-1,"")
      
        $btn_add=GUICtrlCreateButton("add", 200,50,40,20)
        $btn_remove=GUICtrlCreateButton("remove", 200,90,40,20)
        GUISetState()
        
While 1
        $msg=Guigetmsg()
        select
        
        case $msg=$GUI_EVENT_CLOSE
        exit
        
        case $msg=$btn_add
            GuiCtrlSetData($list2, GuiCtrlRead($list1))
    
        case $msg=$btn_remove
        $i_index = _GUICtrlListGetCaretIndex($list2)    ;;added
        _GUICtrlListDeleteItem($list2, $i_index)        ;;added

            
EndSelect  
WEnd

Just 3 lines needed adding.

HTH

HardCopy :)


Contributions: UDF _DateYearFirstChildren are like Farts, you can just about stand your own.Why am I not a Vegetarian?...Well...my ancestors didn't fight & evolve to the Top of the food chain for me to survive on Salad

Share this post


Link to post
Share on other sites

Thanks, HardCopy. It's working ... :)

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