Jump to content

Set variables in GUICtrlCreateList


Recommended Posts

I have this script for example

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 359, 251, 332, 228)
$List1 = GUICtrlCreateList("", 64, 24, 225, 201)
GUICtrlSetData(-1, "A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

I want to put variables in the GUICtrlSetData. I tried to delete the quotation marks, and replace the letters with variables.

It doesn't work.

Do you have any idea how to do it?

Link to comment
Share on other sites

Works for me

#include <GUIConstants.au3>

Local $a = "line1", $b = "line2", $c = "line3", $d = "line4"
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 359, 251, 332, 228)
$List1 = GUICtrlCreateList("", 64, 24, 225, 201)
GUICtrlSetData(-1, $a & "|" & $b & "|" & $c & "|" & $d)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Link to comment
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
 Share

  • Recently Browsing   0 members

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