Jump to content

List


Recommended Posts

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

Link to comment
Share on other sites

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

#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]
Link to comment
Share on other sites

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