Jump to content

Guictrlcreatelist


litlmike
 Share

Recommended Posts

I know there's a way to select multiple options in a GUICtrlCreateList, but I haven't found a way to get the script to read all of the selected controls. To allow multiple selections, I think it's just a setting you add, check the help file for it, something like $LS_MULTIPLESEL or something...

Link to comment
Share on other sites

I know there's a way to select multiple options in a GUICtrlCreateList, but I haven't found a way to get the script to read all of the selected controls. To allow multiple selections, I think it's just a setting you add, check the help file for it, something like $LS_MULTIPLESEL or something...

Thanks for the input. I wasn't able to find the Mulitple Selection setting. Does anyone know the exact setting?
Link to comment
Share on other sites

  • Moderators

Thanks for the input. I wasn't able to find the Mulitple Selection setting. Does anyone know the exact setting?

Could you use GUICtrlCreateListView() instead? If so then use something like this for the style.

BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS)
Link to comment
Share on other sites

$listbox = GUICtrlCreateList("", 125, 40, 180, 120, BitOR($LBS_SORT, $WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY, $LBS_MULTIPLESEL))

Yea, I guess that did get left out of the Help File. Who do we notify about that?

Second, I tried the code given but got the following error: Do I need to #include something besides <GUIConstants.au3>?

WARNING: $LBS_MULTIPLESEL: possibly used before declaration.

ERROR: $LBS_MULTIPLESEL: undeclared global variable.

Link to comment
Share on other sites

Yea, I guess that did get left out of the Help File. Who do we notify about that?

Second, I tried the code given but got the following error: Do I need to #include something besides <GUIConstants.au3>?

No one, it's a part of the beta UDFs

Global Const $LBS_MULTIPLESEL = 0x8

SciTE for AutoItDirections for Submitting Standard UDFs

 

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

 

Link to comment
Share on other sites

No one, it's a part of the beta UDFs

Global Const $LBS_MULTIPLESEL = 0x8
Hey, thanks for the info.

I got a feeling you know more about programming than any 1 person should be allowed to. :think:

You have very easily answered some of my questions in the past that have haunted me, and puzzled others.

Thanks a lot.

Link to comment
Share on other sites

Can anyone tell me why this does not work?

When I set the list items as a variable, they do not work.

$Alphabet = "a|b|c|d|e|f|g|h|i"

$listbox = GUICtrlCreateList($Alphabet, 125, 40, 180, 120, BitOR($LBS_SORT, $WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY, $LBS_MULTIPLESEL))
Nevermind, I needed to use, GuiCtrlSetData. I got to work.
Link to comment
Share on other sites

Then should it not be in the beta help file?

Example from the beta help file

#include <GUIConstants.au3>
#include <GuiList.au3>

Opt ('MustDeclareVars', 1)

Dim $msg, $ret, $listbox, $button, $i

GUICreate("ListBox Selected Items Indices Demo", 400, 250, -1, -1)
$listbox = GUICtrlCreateList("", 125, 40, 180, 120, BitOR($LBS_SORT, $WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY, $LBS_MULTIPLESEL))
GUICtrlSetData($listbox, "test1|more testing|even more testing|demo|")
$button = GUICtrlCreateButton("Get Selected", 150, 160, 120, 40)
GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $button
            $ret = _GUICtrlListGetSelItems ($listbox)
            If (Not IsArray($ret)) Then
                MsgBox(16, "Error", "Unknown error from _GUICtrlListGetSelItems")
            Else
                For $i = 1 To $ret[0]
                    MsgBox(0, "Selected", $ret[$i])
                Next
            EndIf
    EndSelect
WEnd

SciTE for AutoItDirections for Submitting Standard UDFs

 

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

 

Link to comment
Share on other sites

Not to be rude, but that is not where 90% of us would go looking for list styles. Maybe there should be a "GUI Control Styles Beta" in the Appendix?

If the powers that be decide to add it to the GuiConstants.au3 then it will be listed, for now it's a part of GuiList.au3 (Author: Me)

Gary

SciTE for AutoItDirections for Submitting Standard UDFs

 

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

 

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...