Jump to content
Sign in to follow this  
Janus

Help to make a list view and find the user selected

Recommended Posts

Janus

Hi

I need som help making a form with a list control. My problem is that the user select 3 point from the list and I have to find thoise points!

Help my out

Best Regard

Janus S. Andrsen

My code is like

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=c:\documents and settings\tester\desktop\epos hr
$Form1_1 = GUICreate("Epos HR Downloader", 633, 454, 193, 115)
GUISetOnEvent($GUI_EVENT_CLOSE, "AForm1_1Close")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "AForm1_1Minimize")
GUISetOnEvent($GUI_EVENT_MAXIMIZE, "AForm1_1Maximize")
GUISetOnEvent($GUI_EVENT_RESTORE, "AForm1_1Restore")
$List1 = GUICtrlCreateList("", 8, 32, 617, 253, BitOR($LBS_SORT, $LBS_MULTIPLESEL, $LBS_STANDARD, $WS_HSCROLL, $WS_VSCROLL, $WS_BORDER))
GUICtrlSetOnEvent(-1, "AList1Click")
GUICtrlSetTip(-1, "Liste over de filer der kan downloades. Vælg de filer der skal hentes")
$Label1 = GUICtrlCreateLabel("Navne på de filer som kan downloades", 8, 8, 188, 17)
GUICtrlSetOnEvent(-1, "ALabel1Click")
$Button1 = GUICtrlCreateButton("AButton1", 48, 304, 75, 25, 0)
GUICtrlSetOnEvent(-1, "AButton1Click")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
GUICtrlSetData($List1, $sArrayString)

;~ For $i = 1 To $rows Step 1
;~  Send("{SPACE}{DOWN}")
;~ Next

;~ Run("notepad")
;~ Sleep(2000)
;~ Send($sArrayString)

While 1
    Sleep(100)
WEnd

Func AForm1_1Close()
    Exit
EndFunc   ;==>AForm1_1Close
Edited by Janus

Share this post


Link to post
Share on other sites
smashly

Hi,

#include <GUIConstants.au3>
#include <GUIListBox.au3>

Opt("GUIOnEventMode", 1)

$Form1_1 = GUICreate("Epos HR Downloader", 633, 454, 193, 115)
GUISetOnEvent($GUI_EVENT_CLOSE, "Event")
$List1 = GUICtrlCreateList("", 8, 32, 617, 253, BitOR($LBS_SORT, $LBS_MULTIPLESEL, $LBS_STANDARD, $WS_HSCROLL, $WS_VSCROLL, $WS_BORDER))
GUICtrlSetData(-1, "Item 1|Item 2|Item 3|Item 4|Item 5|Item 6")
GUICtrlSetTip(-1, "Liste over de filer der kan downloades. Vælg de filer der skal hentes")
$Label1 = GUICtrlCreateLabel("Navne på de filer som kan downloades", 8, 8, 188, 17)
$Button1 = GUICtrlCreateButton("Get Selected", 48, 304, 90, 25)
GUICtrlSetOnEvent(-1, "Event")
GUISetState(@SW_SHOW)

While 1
    Sleep(100)
WEnd

Func Event()
    Switch @GUI_CtrlId
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            Local $sList
            Dim $aList = _GUICtrlListBox_GetSelItems($List1)
            If $aList[0] <> "" Then
                For $i = 1 To $aList[0]
                    $sList &= _GUICtrlListBox_GetText($List1, $aList[$i]) & @LF
                Next
                MsgBox(0,"Selected Items:", StringTrimRight($sList, 1))
            Else
                MsgBox(0,"Nothing Selected.", "Nothing selected in list.")
            EndIf
    EndSwitch
EndFunc

Cheers

Share this post


Link to post
Share on other sites
rasim

This?

#include <GUIConstants.au3>
#include <GuiListBox.au3>

Dim $LBItemArray

Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=c:\documents and settings\tester\desktop\epos hr
$Form1_1 = GUICreate("Epos HR Downloader", 633, 454, 193, 115)
GUISetOnEvent($GUI_EVENT_CLOSE, "AForm1_1Close")

;GUISetOnEvent($GUI_EVENT_MINIMIZE, "AForm1_1Minimize")

;GUISetOnEvent($GUI_EVENT_MAXIMIZE, "AForm1_1Maximize")

;GUISetOnEvent($GUI_EVENT_RESTORE, "AForm1_1Restore")

$List1 = GUICtrlCreateList("", 8, 32, 617, 253, BitOR($LBS_SORT, $LBS_MULTIPLESEL, $LBS_STANDARD, $WS_HSCROLL, $WS_VSCROLL, $WS_BORDER))
GUICtrlSetData(-1, "String_1")
GUICtrlSetData(-1, "String_2")
GUICtrlSetData(-1, "String_3")

;GUICtrlSetOnEvent(-1, "AList1Click")
GUICtrlSetTip(-1, "Liste over de filer der kan downloades. V?lg de filer der skal hentes")
$Label1 = GUICtrlCreateLabel("Navne pa de filer som kan downloades", 8, 8, 188, 17)
;GUICtrlSetOnEvent(-1, "ALabel1Click")
$Button1 = GUICtrlCreateButton("AButton1", 48, 304, 75, 25, 0)
;GUICtrlSetOnEvent(-1, "AButton1Click")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
;GUICtrlSetData($List1, $sArrayString)

;~ For $i = 1 To $rows Step 1
;~  Send("{SPACE}{DOWN}")
;~ Next

;~ Run("notepad")
;~ Sleep(2000)
;~ Send($sArrayString)

While 1
    $LBItemArray = _GUICtrlListBox_GetSelItems($List1)
    If $LBItemArray[0] = 3 Then MsgBox(0, "Yes", "3 items selected")
    Sleep(100)
WEnd

Func AForm1_1Close()
    Exit
EndFunc   ;==>AForm1_1Close

Share this post


Link to post
Share on other sites
Janus

Thanks :)

Janus S. Andersen

Edited by Janus

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  

×