Sign in to follow this  
Followers 0
BlueScreen

List issues

2 posts in this topic

Hi all,

I am having an issue here

I have written a script which draws several list controls on a form. Near every list, I have a Browse button (in order to put the file names to be chosen by the user into the list). The issue is that I want the selected files (which were selected by the Browse button) to be displayed in the appropriate list near it. I have created a function which allows the user to choose the files, but how to do in order to use only ONE function (which will receive the browse button parameter) and put the data in the relevant list?

;Some GUI stuff here

$mylist1=GUICtrlCreateList ("", 305,80,140,60)
$BrowseButton1=GUICtrlCreateButton ("Browse",460,90,60,20)
GUICtrlCreateLabel ("",  270, 90, 100,50)

$mylist3=GUICtrlCreateList ("", 305,130,140,60)
$BrowseButton2=GUICtrlCreateButton ("Browse",460,150,60,20)
GUICtrlCreateLabel ("",  270, 150, 100,50)

$mylist4=GUICtrlCreateList ("", 305,180,140,40)
$BrowseButton3=GUICtrlCreateButton ("Browse",460,190,60,20)
GUICtrlCreateLabel ("",  270, 190, 100,50)

$mylist5=GUICtrlCreateList ("", 305,220,140,40)
$BrowseButton6=GUICtrlCreateButton ("Browse",460,230,60,20)
GUICtrlCreateLabel ("",  270, 230, 100,50)


While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
            Exit
    
        Case $msg = $BrowseButton1
            Browse(1)
        
        Case $msg = $BrowseButton3
            Browse(3)
            
        Case $msg = $BrowseButton4
            Browse(4)
            
        Case $msg = $BrowseButton6
            Browse(6)
    EndSelect
Wend

Func Browse ($Button)
    
    $fileInput = FileOpenDialog("Select files", "c:\", "txt (*.txt)", 1+4)
    $array=StringSplit($fileInput,"|")
        
;;; Some code here. I have the file names in an array called $array
    
    $NumOfFileChosen= blablabla
    
;now let's put the names in the appropriate list box
    For $i=1 to $NumOfFileChosen
        GUICtrlSetData(????,$array[$i])
    Next
    
EndFunc

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

OK, I have found how to do it.

While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
            Exit
    
        Case $msg = $BrowseButton1
            Browse($mylist1)
        
        Case $msg = $BrowseButton3
            Browse($mylist3)
            
        Case $msg = $BrowseButton4
            Browse($mylist4)
            
        Case $msg = $BrowseButton6
            Browse($mylist6)
    EndSelect
Wend

Thanks :)

Edited by BlueScreen

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