Jump to content
Sign in to follow this  
BattleOfMoonShae

GuiList with input box

Recommended Posts

BattleOfMoonShae

I am toying with the example GUICreateList from the help file and have modified it to use a group with a input box. I want to use the input box to add to the list but I can not figure out how to get the line break to work on the GUICtrlSetData($mylist, GUICtrlRead($Input_2)). ( pipe | ) I have a script on the server already using the create list but I want the tellers to be able to add new names to the list. I am a learning but I am stumped.

#include <GUIConstants.au3>

GLOBAL $MESSAGE = "The following buttons have been clicked"
GUICreate("My GUI list"); will create a dialog box that when displayed is centered

$add=GUICtrlCreateButton ("Add", 64,32,75,25)
$clear=GUICtrlCreateButton ("Clear", 64,72,75,25)
$mylist=GUICtrlCreateList ("buttons that have been clicked", 176,32,121,97)
GUICtrlSetLimit(-1,200); to limit horizontal scrolling
GUICtrlSetData(-1,$MESSAGE)
$close=GUICtrlCreateButton ("my closing button", 64,160,175,25)

$group_1 = GUICtrlCreateGroup ("Group 1", 30, 210, 165, 70)
GUIStartGroup()
$Input_2 = GuiCtrlCreateInput("", 32, 240, 161, 20)

GUISetState ()

$msg = 0
While $msg <> $GUI_EVENT_CLOSE
    $msg = GUIGetMsg()

    Select
    case $msg = $add
;~      GUICtrlSetData($mylist,"You clicked button No1|")        *original*
         
        GUICtrlSetData($mylist,  GUICtrlRead($Input_2))
;~      GUICtrlSetData($mylist,  GUICtrlRead($Input_2),"|")
;~      GUICtrlSetData($mylist, "|")
         case $msg = $clear
        GUICtrlSetData($mylist,"")
         Case $msg = $close
            MsgBox(0,"", "the closing button has been clicked",2)
            Exit
    EndSelect
Wend

Share this post


Link to post
Share on other sites
Ejoc

GUICtrlSetData($mylist,  GUICtrlRead($Input_2) & "|")

?

I'm not sure if that is what you want, as the original seemed functional too me. The version you posted added new entries to the top of the list, and doesnt duplicate entries, my version adds to the bottom of the list and allows for duplicate entries.


Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs

Share this post


Link to post
Share on other sites
CyberSlug

I'm not sure what you are trying to do. :)

I guess you saw the GuiCtrlSetData docs which said

For Combo or List control :

If the "data" corresponds to an already existing entry it is set as the default.

If the "data" starts with | or is an empty string "" the previous list is destroyed.

Do you have text with linebreaks (@CRLF's) that you want to replace with pipes??? StringReplace($text, @CRLF, "|")


Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites
BattleOfMoonShae

& <---- Thats what I was missing. Thanks Ejoc. It never fails to amaze me how the simplist of answers blow right by ya because you are to busy looking for the hardest of answers. @CyberSlug Your Autobuilder is fine work.

Thanks, once again for your help.

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  

×