Jump to content
Sign in to follow this  

GUICtrlCreatelist HELP

Recommended Posts


I have this list here:

$list = GUICtrlCreatelist("",0,48,138,292,-1,512)
GUICtrlSetData($list, $string)

$b = GUICtrlCreateButton("button")
GUICtrlSetOnEvent($b, "function")

func function()
$var = getselecteditemfromlist ;right here i wanna get the list item
msgbox(0, "Selected Item", $var)

How can i get what is selected? like the user clicks on one of the list items, and i wanna set just that one item to a variable when i click a button to call the function to set the variable.

Share this post

Link to post
Share on other sites


How can i get what is selected?

Just read the control: ;)

#include <GUIConstantsEx.au3>

Opt("GUIOnEventMode", 1)

$hGUI = GUICreate("Test", 500, 500)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")

$cList = GUICtrlCreateList("", 10, 10, 200, 200)
GUICtrlSetData(-1, "100|200|300|400|500")

$cButton = GUICtrlCreateButton("Read List", 10, 300, 80, 30)
GUICtrlSetOnEvent($cButton, "_Read_List")


While 1

Func _Read_List()
    $sSel = GUICtrlRead($cList) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    MsgBox(0, "List", "Selected item: " & $sSel)

Func _Exit()

And what are these "magic numbers" (-1,512) you have in your List creation line? :huh:

We do not include the *Constant.au3 files for nothing you know. ;)


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:


ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area


Share this post

Link to post
Share on other sites

i feel really stupid now >.> thanks alot lol, and i set up my gui using ISN studio, and thats how it set up the parameters.

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