Jump to content

Radio turns into button


Recommended Posts

Hi,

once upon a time I searched for a button with the look & feel like it is pressed. But I couldn't find it.

Thread

By accident, I changed a Radio like I would change a label to get it sunken.

Then the radio changed into a "nice" button.

Is this option supported? Gary you are the GUI-man. :whistle:

Have a look at:

$taskkill_R = GUICtrlCreateRadio("Taskkill", 16, 64, 80, 17, $SS_SUNKEN)

$winClose_R = GUICtrlCreateRadio("WinClose", 16, 88, 80, 17, $SS_SUNKEN)

$winKill_R = GUICtrlCreateRadio("WinKill", 16, 112, 80, 17, $SS_SUNKEN)

$processClose_R = GUICtrlCreateRadio("ProcessClose", 16, 136, 80, 17, $SS_SUNKEN)

$pid_R = GUICtrlCreateRadio("ProcessID", 126, 112, 80, 17)

Opt("WinTitleMatchMode", 4)
#include <GUIConstants.au3>
#include <Process.au3>

$GUI = GUICreate("Exit Programm", 233, 251, 192, 125)
;Group
$options_G = GUICtrlCreateGroup("Options", 8, 40, 217, 201)
;RadioButton
$taskkill_R = GUICtrlCreateRadio("Taskkill", 16, 64, 80, 17, $SS_SUNKEN)
$winClose_R = GUICtrlCreateRadio("WinClose", 16, 88, 80, 17, $SS_SUNKEN)
$winKill_R = GUICtrlCreateRadio("WinKill", 16, 112, 80, 17, $SS_SUNKEN)
$processClose_R = GUICtrlCreateRadio("ProcessClose", 16, 136, 80, 17, $SS_SUNKEN)
$pid_R = GUICtrlCreateRadio("ProcessID", 126, 112, 80, 17)
;Label
$status_L = GUICtrlCreateLabel("Ready...", 16, 216, 203, 17, $SS_SUNKEN)
$headline_L = GUICtrlCreateLabel("Exit Program", 16, 8, 211, 25)
$program_L = GUICtrlCreateLabel("Choose Program", 16, 160, 203, 17, $SS_SUNKEN)
;Button
$Go_B = GUICtrlCreateButton("GO", 126, 64, 89, 30)
;ComboBox
$processCombo_C = GUICtrlCreateCombo("", 16, 184, 201, 21)

GUICtrlSetColor($headline_L, "0xff0000")
GUICtrlSetColor($program_L, "0xff0000")
GUICtrlSetFont($headline_L, 14, 400, "", "Arial")
GUICtrlSetState($processCombo_C, $GUI_FOCUS)
GUISetState(@SW_SHOW)

GUICtrlSetState($taskkill_R, $GUI_CHECKED)

_processCombo()

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Go_B
            If GUICtrlRead($taskkill_R) = $GUI_CHECKED Then _taskkill()
            If GUICtrlRead($winClose_R) = $GUI_CHECKED Then _winClose()
            If GUICtrlRead($winKill_R) = $GUI_CHECKED Then _winKill()
            If GUICtrlRead($processClose_R) = $GUI_CHECKED Then _processClose()
            If GUICtrlRead($pid_R) = $GUI_CHECKED Then _killByPID()
        Case $msg = $taskkill_R Or $msg = $processClose_R
            _processCombo()
        Case $msg = $winKill_R Or $msg = $winClose_R
            _winListCombo()
        Case Else
        ;;;;;;;
    EndSelect
WEnd

Func _taskkill()
    $rc = _RunDOS("start taskkill /F /IM " & GUICtrlRead($processCombo_C) & " /T")
    GUICtrlSetData($status_L, "Process " & GUICtrlRead($processCombo_C) & " killed")
    Sleep(2500)
    GUICtrlSetData($status_L, "Ready...")
EndFunc  ;==>_taskkill

Func _winClose()
    If WinExists(GUICtrlRead($processCombo_C)) Then
        WinClose(GUICtrlRead($processCombo_C))
    Else
        GUICtrlSetData($status_L, "Window doesn't exist")
        Sleep(2500)
        GUICtrlSetData($status_L, "Ready...")
    EndIf
EndFunc  ;==>_winClose

Func _winKill()
    If WinExists(GUICtrlRead($processCombo_C)) Then
        WinKill(GUICtrlRead($processCombo_C))
    Else
        GUICtrlSetData($status_L, "Window doesn't exist")
        Sleep(2500)
        GUICtrlSetData($status_L, "Ready...")
    EndIf
EndFunc  ;==>_winKill

Func _processClose()
    If ProcessExists(GUICtrlRead($processCombo_C)) Then
        ProcessClose(GUICtrlRead($processCombo_C))
    Else
        GUICtrlSetData($status_L, "Process doesn't exist")
        Sleep(2500)
        GUICtrlSetData($status_L, "Ready...")
    EndIf
EndFunc  ;==>_processClose

Func _killByPID()
    If _ProcessGetName(GUICtrlRead($processCombo_C)) <> '' Then
        $rc = _RunDOS("start taskkill /PID " & GUICtrlRead($processCombo_C) & " /T")
        GUICtrlSetData($status_L, "ProcessID " & GUICtrlRead($processCombo_C) & " - (" & _ProcessGetName(GUICtrlRead($processCombo_C)) & ")" & " killed")
        Sleep(2500)
        GUICtrlSetData($status_L, "Ready...")
    Else
        GUICtrlSetData($status_L, "ProcessID doesn't exist")
        Sleep(2500)
        GUICtrlSetData($status_L, "Ready...")
    EndIf
EndFunc  ;==>_killByPID

Func _processCombo()
    Dim $processArray = ProcessList()
    For $i = 1 To $processArray[0][0]
        GUICtrlSetData($processCombo_C, $processArray[$i][0])
    Next
EndFunc  ;==>_processCombo

Func _winListCombo()
    Dim $windowArray = WinList()
    For $i = 1 To $windowArray[0][0]
    ; Only display visble windows that have a title
        If $windowArray[$i][0] <> "" Then;AND IsVisible($var[$i][1]) Then
            GUICtrlSetData($processCombo_C, $windowArray[$i][0])
        EndIf
    Next
EndFunc  ;==>_winListCombo

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

a radio is a button, funny what can be done by chance sometimes

http://msdn.microsoft.com/library/en-us/sh...esandstyles.asp

Edit: i see what it does, makes it a push button, that is a type of button also.

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

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

 

Link to comment
Share on other sites

a radio is a button, funny what can be done by chance sometimes

http://msdn.microsoft.com/library/en-us/sh...esandstyles.asp

Edit: i see what it does, makes it a push button, that is a type of button also.

Hi Gary,

thanks for checking that out. So, why isn't the push button supported in Autoit? Will it be?

Once I tried something like that, cause I needed to make clear in my Yahtzee game, which dices you want to keep, but I coulnd'nt find this sort of button. :whistle:

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Hi Gary,

thanks for checking that out. So, why isn't the push button supported in Autoit? Will it be?

Once I tried something like that, cause I needed to make clear in my Yahtzee game, which dices you want to keep, but I coulnd'nt find this sort of button. :whistle:

So long,

Mega

It is, look at the checkbox styles in the help ($BS_PUSHLIKE)

SciTE for AutoItDirections for Submitting Standard UDFs

 

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

 

Link to comment
Share on other sites

HI,

yes. :) But look at this example. I'm not able by helpfile to predict what happens here:

#include <GUIConstants.au3>
GUICreate("My GUI ", 700, 200)  ; will create a dialog box that when displayed is centered
$1_CB = GUICtrlCreateCheckbox("CHECKBOX 1", 10, 10, 120, 20, $BS_Pushlike+ $BS_FLAT )
$2_CB = GUICtrlCreateCheckbox("CHECKBOX 2", 10, 40, 120, 20, $BS_Pushlike)
$3_CB = GUICtrlCreateCheckbox("CHECKBOX 3", 10, 70, 120, 20, $SS_SUNKEN)
$1_R = GUICtrlCreateRadio("Radio 1", 200, 10, 120, 20, $BS_Pushlike)
$2_R = GUICtrlCreateRadio("Radio 2", 200, 40, 120, 20, $SS_SUNKEN)
$3_R = GUICtrlCreateRadio("Radio 3", 200, 70, 120, 20, $BS_AUTORADIOBUTTON)
$1_B = GUICtrlCreateButton("Button 1", 400, 10, 120, 20, $BS_GROUPBOX)
$2_B = GUICtrlCreateButton("Button 2", 400, 40, 120, 20, $BS_Pushlike)
$3_B = GUICtrlCreateButton("Button 3", 400, 70, 120, 20, $SS_SUNKEN)
GUISetState()       
While 1
    If GUIGetMsg() = $GUI_EVENT_CLOSE Then ExitLoop
WEnd

Some kind of weird things ... :whistle:

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

some not so wierd

Global Const $BS_PUSHLIKE       = 0x1000
Global Const $SS_SUNKEN         = 0x1000
HI,

never stop learning. :"> What I also didn't know before was, that the style has such an impact on the control.

Thanks!

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

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