Jump to content

Recommended Posts

Posted

I would like to write a GUI script such that I can add and remove file to a listbox. I have no concept to start with. Anyone got the simple sample code for me to reference with? Thx.

Posted

I would like to write a GUI script such that I can add and remove file to a listbox. I have no concept to start with. Anyone got the simple sample code for me to reference with? Thx.

<{POST_SNAPBACK}>

Take a look at these UDF's ListBox UDFs I believe this will help you a lot.

.

Posted (edited)

It is in the latest beta.

http://www.autoitscript.com/forum/index.ph...opic=10256&st=0

once you have the latest beta, go to the help and User Defined Functions you'll see GuiListBox Management

If you have any problems understanding the examples let me know, I tried to make them as simple as possible.

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Posted (edited)

Take what help I can get, If you look in the include you'll note I made sure you were included on some of the functions.

Hoping to be able to impliment some more once and if ejoc gets the dll stuff into autoit.

Also submitted, GuiComboBox, GuiListView, but might be a while for those to make it into the beta, noticed there's alot going on.

Thanks for you help.

Edit: checked that function, will only need to change documentation, it already works with single selection, still returns array at this point.

Edit2: got _GUICtrlListBoxGetSelItemsText also will work with single sel listbox, but i'll need to submit the changes.

Func _GUICtrlListBoxGetSelItemsText($h_listbox)
    Local $i, $s_list = "", $i_ret
    For $i = 0 To GuiCtrlSendMsg($h_listbox,$LB_GETCOUNT,0,0) - 1
        $i_ret = GuiCtrlSendMsg($h_listbox,$LB_GETSEL,$i,0)
        If( $i_ret > 0 )Then
            If(StringLen($s_list) > 0) Then
                $s_list = $s_list & ',' & $i 
            Else
                $s_list = $i
            EndIf
        ElseIf( $i_ret == $LB_ERR) Then 
            Return $LB_ERR
        EndIf
    Next;$s_list should now equal the selected items

    If(StringLen($s_list) > 0) Then
        Local $a_text = StringSplit( $s_list, "," )
        For $i = 1 to $a_text[0]
            $a_text[$i] = GuiCtrlRecvMsg($h_listbox,$LB_GETTEXT,$a_text[$i],1)
        Next
        Return $a_text
    Else
        Return $LB_ERR
    EndIf
EndFunc
Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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
  • Recently Browsing   0 members

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