Jump to content
Sign in to follow this  
dinodod

reading a GUICtrlCreateList

Recommended Posts

dinodod

I am trying to make a series of buttons that a user can push. Each time, the value is added to the GUICtrlCreateList control.

Problem is, how do I read the GUICtrlCreateList control afterwards?

Any thoughts on cleaning the code? There will be xx patches each time.

Thanks!

==============================================

#include <GUIConstants.au3>

;GLOBAL $MESSAGE = "MS05-000"

$sum = 0

$p = 0

GUICreate("My GUI list") ; will create a dialog box that when displayed is centered

;Patch Names

;========================

$PatchName1 = "MS05-001"

$PatchName2 = "MS05-012"

$PatchName3 = "MS05-053"

$PatchName4 = "MS05-024"

$PatchName5 = "MS05-075"

$PatchName6 = "MS05-016"

$PatchName7 = "MS05-007"

$PatchName8 = "MS05-008"

$PatchName9 = "MS05-009"

$PatchName10 = "MS05-010"

;Menu

; ========================

$Patch01 = GUICtrlCreateButton ($PatchName1, 64,30,75,25)

$Patch02 = GUICtrlCreateButton ($PatchName2, 64,60,75,25)

$Patch03 = GUICtrlCreateButton ($PatchName3, 64,90,75,25)

$Patch04 = GUICtrlCreateButton ($PatchName4, 64,120,75,25)

$Patch05 = GUICtrlCreateButton ($PatchName5, 64,150,75,25)

$Patch06 = GUICtrlCreateButton ($PatchName6, 64,180,75,25)

$Patch07 = GUICtrlCreateButton ($PatchName7, 64,210,75,25)

$Patch08 = GUICtrlCreateButton ($PatchName8, 64,240,75,25)

$Patch09 = GUICtrlCreateButton ($PatchName9, 64,270,75,25)

$Patch10 = GUICtrlCreateButton ($PatchName10, 64,300,75,25)

$mylist = GUICtrlCreateList ("", 200,32,100,97)

$clear=GUICtrlCreateButton ("Clear", 195,122,75,25)

$ApplyPatches=GUICtrlCreateButton ("Apply Patches", 184,160,105,25)

;GUICtrlSetLimit(-1,200) ; to limit horizontal scrolling

;GUICtrlSetData(-1,$MESSAGE)

GUISetState ()

$msg = 0

While $msg <> $GUI_EVENT_CLOSE

$msg = GUIGetMsg()

Select

Case $msg = $Patch01

GUICtrlSetData($mylist,$PatchName1)

Case $msg = $Patch02

GUICtrlSetData($mylist,$PatchName2)

Case $msg = $Patch03

GUICtrlSetData($mylist,$PatchName3)

Case $msg = $Patch04

GUICtrlSetData($mylist,$PatchName4)

Case $msg = $Patch05

GUICtrlSetData($mylist,$PatchName5)

Case $msg = $Patch06

GUICtrlSetData($mylist,$PatchName6)

Case $msg = $Patch07

GUICtrlSetData($mylist,$PatchName7)

Case $msg = $Patch08

GUICtrlSetData($mylist,$PatchName8)

Case $msg = $Patch09

GUICtrlSetData($mylist,$PatchName9)

Case $msg = $Patch10

GUICtrlSetData($mylist,$PatchName10)

case $msg = $clear

GUICtrlSetData($mylist,"")

Case $msg = $ApplyPatches

msgbox(0,"", $Mylist)

EndSelect

Wend


Digital Chaos - Life as we know it today.I'm a Think Tank. Problem is, my tank is empty.The Quieter you are, the more you can HearWhich would you choose - Peace without Freedom or Freedom without Peace?Digital Chaos Macgyver ToolkitCompletely Dynamic MenuSQLIte controlsAD FunctionsEXCEL UDFPC / Software Inventory UDFPC / Software Inventory 2GaFrost's Admin Toolkit - My main competitor :)Virtual SystemsVMWAREMicrosoft Virtual PC 2007

Share this post


Link to post
Share on other sites
GaryFrost

#include <GUIConstants.au3>

;GLOBAL $MESSAGE = "MS05-000"
$sum = 0
$p = 0
GUICreate("My GUI list"); will create a dialog box that when displayed is centered

;Patch Names
;========================
$PatchName1 = "MS05-001"
$PatchName2 = "MS05-012"
$PatchName3 = "MS05-053"
$PatchName4 = "MS05-024"
$PatchName5 = "MS05-075"
$PatchName6 = "MS05-016"
$PatchName7 = "MS05-007"
$PatchName8 = "MS05-008"
$PatchName9 = "MS05-009"
$PatchName10 = "MS05-010"


;Menu
; ========================
$Patch01 = GUICtrlCreateButton($PatchName1, 64, 30, 75, 25)
$Patch02 = GUICtrlCreateButton($PatchName2, 64, 60, 75, 25)
$Patch03 = GUICtrlCreateButton($PatchName3, 64, 90, 75, 25)
$Patch04 = GUICtrlCreateButton($PatchName4, 64, 120, 75, 25)
$Patch05 = GUICtrlCreateButton($PatchName5, 64, 150, 75, 25)
$Patch06 = GUICtrlCreateButton($PatchName6, 64, 180, 75, 25)
$Patch07 = GUICtrlCreateButton($PatchName7, 64, 210, 75, 25)
$Patch08 = GUICtrlCreateButton($PatchName8, 64, 240, 75, 25)
$Patch09 = GUICtrlCreateButton($PatchName9, 64, 270, 75, 25)
$Patch10 = GUICtrlCreateButton($PatchName10, 64, 300, 75, 25)



$mylist = GUICtrlCreateList("", 200, 32, 100, 97)
$clear = GUICtrlCreateButton("Clear", 195, 122, 75, 25)
$ApplyPatches = GUICtrlCreateButton("Apply Patches", 184, 160, 105, 25)

;GUICtrlSetLimit(-1,200); to limit horizontal scrolling
;GUICtrlSetData(-1,$MESSAGE)


GUISetState()

$msg = 0
While $msg <> $GUI_EVENT_CLOSE
    $msg = GUIGetMsg()
    
    Select
        Case $msg = $Patch01
            GUICtrlSetData($mylist, $PatchName1)
            
        Case $msg = $Patch02
            GUICtrlSetData($mylist, $PatchName2)
            
        Case $msg = $Patch03
            GUICtrlSetData($mylist, $PatchName3)
            
        Case $msg = $Patch04
            GUICtrlSetData($mylist, $PatchName4)
            
        Case $msg = $Patch05
            GUICtrlSetData($mylist, $PatchName5)
            
        Case $msg = $Patch06
            GUICtrlSetData($mylist, $PatchName6)
            
        Case $msg = $Patch07
            GUICtrlSetData($mylist, $PatchName7)
            
        Case $msg = $Patch08
            GUICtrlSetData($mylist, $PatchName8)
        Case $msg = $Patch09
            GUICtrlSetData($mylist, $PatchName9)
            
        Case $msg = $Patch10
            GUICtrlSetData($mylist, $PatchName10)
            
            
        Case $msg = $clear
            GUICtrlSetData($mylist, "")
            
            
        Case $msg = $ApplyPatches
            $patches = ""
            For $x = 0 To _GUICtrlListCount($mylist) - 1
                $patches = $patches & _GUICtrlListGetText($mylist, $x) & @LF
            Next
            $patches = StringTrimRight($patches,1)
            MsgBox(0, "", $patches)
            
    EndSelect
WEnd

Func _GUICtrlListGetText($h_listbox, $i_index)
    Const $LB_GETTEXT = 0x0189
    Return GUICtrlRecvMsg($h_listbox, $LB_GETTEXT, $i_index, 1)
EndFunc  ;==>_GUICtrlListGetText

Func _GUICtrlListCount($h_listbox)
    Const $LB_GETCOUNT = 0x18B
    Return GUICtrlSendMsg($h_listbox, $LB_GETCOUNT, 0, 0)
EndFunc  ;==>_GUICtrlListCount


SciTE for AutoItDirections for Submitting Standard UDFs

 

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

 

Share this post


Link to post
Share on other sites
dinodod

:whistle:

Wow! Sweet! Thanks! Where did you find this bit of info?


Digital Chaos - Life as we know it today.I'm a Think Tank. Problem is, my tank is empty.The Quieter you are, the more you can HearWhich would you choose - Peace without Freedom or Freedom without Peace?Digital Chaos Macgyver ToolkitCompletely Dynamic MenuSQLIte controlsAD FunctionsEXCEL UDFPC / Software Inventory UDFPC / Software Inventory 2GaFrost's Admin Toolkit - My main competitor :)Virtual SystemsVMWAREMicrosoft Virtual PC 2007

Share this post


Link to post
Share on other sites
dinodod

I'm going to take a guess here...The help file?

<{POST_SNAPBACK}>

I already looked in the help file but they didn't mention how to manipulate the listbox.

Digital Chaos - Life as we know it today.I'm a Think Tank. Problem is, my tank is empty.The Quieter you are, the more you can HearWhich would you choose - Peace without Freedom or Freedom without Peace?Digital Chaos Macgyver ToolkitCompletely Dynamic MenuSQLIte controlsAD FunctionsEXCEL UDFPC / Software Inventory UDFPC / Software Inventory 2GaFrost's Admin Toolkit - My main competitor :)Virtual SystemsVMWAREMicrosoft Virtual PC 2007

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  

×