Jump to content

Live Combo.


Aceguy
 Share

Recommended Posts

when using a combo box, is there a way to update a label while selecting the contents of a combo box, (beofre confirming selection)

:D many thanks

I did this in the shell comp... :P

$shtdpwn = GUICreate("Shudown", 213, 183)
    $Label1 = GUICtrlCreateLabel("What would you like your computer to do?", 4, 4, 203, 17)
    $CboShutdown = GUICtrlCreateCombo("", 4, 28, 205, 25, $CBS_DROPDOWNLIST)
    GUICtrlSetData(-1, "Exit|Standby|Shutdown|Reboot|Hibernate", "Exit")
    $lblabout = GUICtrlCreateLabel("Exits this program", 4, 80, 203, 50)
    $btnOK = GUICtrlCreateButton("OK", 132, 152, 75, 25)
    GUICtrlSetState(-1, $GUI_DEFBUTTON)
    $btnCancel = GUICtrlCreateButton("Cancel", 52, 152, 75, 25)
    $chkForce = GUICtrlCreateCheckbox("Force", 4, 56, 201, 17)
    GUISetState(@SW_SHOW)
    
    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
            Case $msg = $CboShutdown Or $msg = $chkForce
                $Shutdown = GUICtrlRead($CboShutdown)
                Select
                    Case $Shutdown = "Exit" 
                        $code = "Exits this program" 
                    Case $Shutdown = "Standby" 
                        $code = "Will send the computer into Standby Mode" 
                    Case $Shutdown = "Shutdown" 
                        $code = "Will shutdown this computer" 
                    Case $Shutdown = "Reboot" 
                        $code = "Will restart this computer" 
                    Case $Shutdown = "Hibernate" 
                        $code = "Will hibernate this computer, saving the current settings." 
                EndSelect
                If GUICtrlRead($chkForce) = $GUI_CHECKED Then
                    $code += @CRLF & @CRLF & "Force the current action" 
                EndIf
                GUICtrlSetData($lblabout, $code)
            Case $msg = $btnOK
                $Shutdown = GUICtrlRead($CboShutdown)
                $code = 0
                Select
                    Case $Shutdown = "Exit" 
                        $code = 0
                    Case $Shutdown = "Standby" 
                        $code = 32
                    Case $Shutdown = "Shutdown" 
                        $code = 1
                    Case $Shutdown = "Reboot" 
                        $code = 2
                    Case $Shutdown = "Hibernate" 
                        $code = 64
                EndSelect
                If GUICtrlGetState($chkForce) = $GUI_CHECKED Then
                    $code += 4
                EndIf
                If $code = 0 Then
                    Exit
                Else
                    MsgBox(0, "", "SHUTDOWN: " & $code)
                ;Shutdown ($code)
                    Exit
                EndIf
            Case $msg = $btnCancel
                ExitLoop
        EndSelect
    WEnd
    GUIDelete($shtdpwn)
Link to comment
Share on other sites

don't forget to put #include <GUIconstants.au3> at the begining, but it is great Example as allways bret you are amaizing!

And remember that you will have to use specific constants in future versions. GUIConstants.au3 will be "deflated" soon... :P or something like that... Erm... Thanks?? :D Edited by Bert
Link to comment
Share on other sites

thanks for quick reply, Altho im after it udating whats under the mouse pointer .

ie.

click combo to bring list up,

using mouse pointer to update the $label to whats under the mouse.?

Link to comment
Share on other sites

thanks for quick reply, Altho im after it udating whats under the mouse pointer .

ie.

click combo to bring list up,

using mouse pointer to update the $label to whats under the mouse.?

Mate, you making about as much sense a kookaburra. I don't understand what you are asking.
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...