Jump to content
Sign in to follow this  
EliTe_ThuT

List

Recommended Posts

EliTe_ThuT

Hi,

I wanted to know if it is possible to use a list (with a content that I generated with the use of a variable ($FList[0], $FList[1], ...)

GUICtrlSetData($list,$FList[1])
GUICtrlSetData($list,$FList[2])
GUICtrlSetData($list,$FList[3])
GUICtrlSetData($list,$FList[4])
GUICtrlSetData($list,$FList[5])
GUICtrlSetData($list,$FList[6])
GUICtrlSetData($list,$FList[7])
GUICtrlSetData($list,$FList[8])
GUICtrlSetData($list,$FList[9])

When you click on a item in that list, it should highlight (so if you click on item 2, 4 and 5...those 3 items will be highlighted). Then when you press a button, it looks at which item has been highlighted so I can work with those values after.

Thanks

Share this post


Link to post
Share on other sites
EliTe_ThuT

Look in the helpfile for the function _GuiCtrlListBox_Create, as well as the other _GuiCtrlListBox_* functions.

I looked at it during at least 2 hours...My problem is not that I'm not able to create the list...it's that I'm not able to select more than one item...and I'm not able to retrieve what items I have selected.

...And by the way "_GuiCtrlListBox_Create" this doesn't exists...

Edited by EliTe_ThuT

Share this post


Link to post
Share on other sites
monoceres

If you use _GUICtrlListBox then you can use the _GUICtrlListBox_GetSel function to retrieve the selected items.


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites
EliTe_ThuT

If you use _GUICtrlListBox then you can use the _GUICtrlListBox_GetSel function to retrieve the selected items.

Why isn't "_GUICtrlListBox" in the help file ??

Share this post


Link to post
Share on other sites
monoceres

Why isn't "_GUICtrlListBox" in the help file ??

It is, look under user defined function, or you are using a really old version of autoit.

Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites
EliTe_ThuT

It is, look under user defined function, or you are using a really old version of autoit.

Isn't there...using AutoIt Version: 3.2.4.9

Share this post


Link to post
Share on other sites
Achilles

#include<ListViewConstants.au3>
#include<GuiConstantsEx.au3>
#include<GuiListView.au3>

$GUI = GUICreate("(UDF Created) ListView Create", 400, 310)

$hListView = _GUICtrlListView_Create($GUI, "", 2, 2, 394, 268, BitOr($LVS_REPORT, $LVS_SHOWSELALWAYS))
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT))

$btn = GuiCtrlCreateButton('Get Selected', 2, 275, 100, 30)
; Add columns
_GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)
_GUICtrlListView_AddItem($hListView, "Row 4: Col 1", 3)
_GUICtrlListView_AddItem($hListView, "Row 5: Col 1", 4)

GUISetState()

; Loop until user exits
While 1 
    Switch GuiGetMsg() 
        Case $GUI_EVENT_CLOSE 
            Exit 
        Case $btn 
            Msgbox(0, '', _GUICtrlListView_GetSelectedIndices($hListView))
            
    EndSwitch 
WEnd
And then you can use those indexes to get the text from the list box.


My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites
EliTe_ThuT

It is, look under user defined function, or you are using a really old version of autoit.

LOL, I didn't know I was using such an old version...that's weird..thx

#include<ListViewConstants.au3>
#include<GuiConstantsEx.au3>
#include<GuiListView.au3>

$GUI = GUICreate("(UDF Created) ListView Create", 400, 310)

$hListView = _GUICtrlListView_Create($GUI, "", 2, 2, 394, 268, BitOr($LVS_REPORT, $LVS_SHOWSELALWAYS))
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT))

$btn = GuiCtrlCreateButton('Get Selected', 2, 275, 100, 30)
; Add columns
_GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)
_GUICtrlListView_AddItem($hListView, "Row 4: Col 1", 3)
_GUICtrlListView_AddItem($hListView, "Row 5: Col 1", 4)

GUISetState()

; Loop until user exits
While 1 
    Switch GuiGetMsg() 
        Case $GUI_EVENT_CLOSE 
            Exit 
        Case $btn 
            Msgbox(0, '', _GUICtrlListView_GetSelectedIndices($hListView))
            
    EndSwitch 
WEnd
And then you can use those indexes to get the text from the list box.
thx, I'll have a look at this

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  

×