Jump to content

Crazy $Radio button :/ any help?


 Share

Recommended Posts

Since last 4 days I'm trying to understand how $radio button works. No success:( Can you help me?

One part of my function call another one which should check radio buttons and call different actions for each of them.

What did I wrong?

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=IRA.ico
#AutoIt3Wrapper_outfile=IRA bot
#AutoIt3Wrapper_Compression=4
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <Array.au3>
#Include <ClipBoard.au3>
#Include <GDIPlus.au3>
#include <IE.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <file.au3>
#include <Date.au3>

#Region ; hotkeys

HotKeySet("{ESC}","Ex")
HotKeySet("{F1}", "start")

Func Ex()
    Exit
EndFunc

Func start()
    $Button0 = 1
EndFunc

#EndRegion


funkcja()

Func funkcja()
        Local   $msg, $menustate, $menutext, $Button0


$MainWin = GUICreate("IRA v.1.7", 180, 300, 1000, 120)
GUICtrlCreateLabel("1", 5, 83)
$input0 = GUICtrlCreateInput("Eril", 18, 80, 70, 20)
GUICtrlCreateLabel("2", 5, 103)
$input1 = GUICtrlCreateInput("Eril", 18, 100, 70, 20)
GUICtrlCreateLabel("3", 5, 123)
$input2 = GUICtrlCreateInput("Eril", 18, 120, 70, 20)
GUICtrlCreateLabel("4", 5, 143)
$input3 = GUICtrlCreateInput("Eril", 18, 140, 70, 20)
GUICtrlCreateLabel("5", 5, 163)
$input4 = GUICtrlCreateInput("Eril", 18, 160, 70, 20)
GUICtrlCreateLabel("6", 5, 183)
$input5 = GUICtrlCreateInput("Eril", 18, 180, 70, 20)




Global $Radio1 = GUICtrlCreateRadio("1", 90, 80, 113, 17)
Global $Radio2 = GUICtrlCreateRadio("2", 90, 100, 113, 17)
Global $Radio3 = GUICtrlCreateRadio("3", 90, 120, 113, 17)
Global $Radio4 = GUICtrlCreateRadio("4", 90, 140, 113, 17)
Global $Radio5 = GUICtrlCreateRadio("5", 90, 160, 113, 17)

$Button0 = GUICtrlCreateButton(" " & @LF & "START" , 10, 24, 70, 50, $BS_MULTILINE)
GUICtrlSetBkColor(-1, 0xB9F8AE)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$Button1 = GUICtrlCreateButton(" " & @LF & "STOP" , 100, 24, 70, 50, $BS_MULTILINE)
GUICtrlSetBkColor(-1, 0xFD3401)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
#EndRegion
GUICtrlSetState($Radio1, $GUI_CHECKED)

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###



Do

$msg = GUIGetMsg()
If $msg = $Button0 Then;
        $response = MsgBox(1, "Confirm", "OK?")
        If $response = 1 Then
                Do

                statystyki()


                Until $msg = $GUI_EVENT_CLOSE
        EndIf

EndIf


#EndRegion

Until $msg = $GUI_EVENT_CLOSE
EndFunc



Func statystyki()
While 1
 Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE
        Exit
    Case GUICtrlGetState($Radio1) = 1
                Sleep(100)
                MsgBox(0, "", "1")
    Case GUICtrlGetState($Radio2) = 1
                Sleep(100)
                MsgBox(0, "", "2")
    Case GUICtrlGetState($Radio3) = 1
                Sleep(100)
                MsgBox(0, "", "3")
    Case GUICtrlGetState($Radio4) = 1
                Sleep(100)
                MsgBox(0, "", "4")
    Case GUICtrlGetState($Radio5) = 1
                Sleep(100)
                MsgBox(0, "", "5")

EndSwitch
WEnd
EndFunc



Func Stop()
    Exit 0
EndFunc
Link to comment
Share on other sites

As for your gui problem quickfix

;...
    GUISetState(@SW_SHOW)
    Do
        $msg = GUIGetMsg()
        If $msg = $Button0 Then;
            If MsgBox(1, "Confirm", "OK?") = 1 Then statystyki()
        EndIf
    Until $msg = $GUI_EVENT_CLOSE
EndFunc



Func statystyki()
    Switch GUIGetMsg()
        Case BitAND(GUICtrlRead($radio1), $GUI_CHECKED) = $GUI_CHECKED
            Sleep(100)
            MsgBox(0, "", "1")
        Case BitAND(GUICtrlRead($radio2), $GUI_CHECKED) = $GUI_CHECKED
            Sleep(100)
            MsgBox(0, "", "2")
        Case BitAND(GUICtrlRead($radio3), $GUI_CHECKED) = $GUI_CHECKED
            Sleep(100)
            MsgBox(0, "", "3")
        Case BitAND(GUICtrlRead($radio4), $GUI_CHECKED) = $GUI_CHECKED
            Sleep(100)
            MsgBox(0, "", "4")
        Case BitAND(GUICtrlRead($radio5), $GUI_CHECKED) = $GUI_CHECKED
            Sleep(100)
            MsgBox(0, "", "5")
    EndSwitch
EndFunc

As for the type of your script

http://www.autoitscript.com/forum/index.php?showannouncement=12&f=2

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

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