Sign in to follow this  
Followers 0
schnibble

Guictrlsetstate & Guictrlsetonevent

3 posts in this topic

Hi,

why does not open with GUICtrlSetState a GUICtrlSetOnEvent Function?

Line 22 or Line24

#include <GUIConstants.au3>

Opt("GUICoordMode",1)
Opt("GUIResizeMode", 1)
Opt("GUIOnEventMode", 1)

$parent1 = GUICreate("Parent1")
GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")

GUICtrlCreateGroup ("", 70, 20, 30 ,50)
$radio1 = GUICtrlCreateRadio ("", 80,30)
GUICtrlSetOnEvent(-1, "radio1")
$radio2 = GUICtrlCreateRadio ("", 80,50)
GUICtrlSetOnEvent(-1, "radio2")

GUISetState(@SW_SHOW)



While 1
    If GUICtrlRead($radio1) = 4 Then
        GUICtrlSetState ($radio1, $GUI_CHECKED);<<<<< problem
    Else
        GUICtrlSetState ($radio2, $GUI_CHECKED);<<<<< problem
    EndIf
    Sleep(1000)
Wend




Func radio1()
    MsgBox(0, "radio1", "ID=" & @GUI_CTRLID & " WinHandle=" & @GUI_WINHANDLE & " CtrlHandle=" & @GUI_CTRLHANDLE)
EndFunc

Func radio2()
    MsgBox(0, "radio2", "ID=" & @GUI_CTRLID & " WinHandle=" & @GUI_WINHANDLE & " CtrlHandle=" & @GUI_CTRLHANDLE)
EndFunc

Func SpecialEvents()
   Exit
EndFunc

Share this post


Link to post
Share on other sites



try:

#include <GUIConstants.au3>

Opt("GUICoordMode",1)
Opt("GUIResizeMode", 1)
Opt("GUIOnEventMode", 1)

$parent1 = GUICreate("Parent1")
GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")

GUICtrlCreateGroup ("", 70, 20, 30 ,50)
$radio1 = GUICtrlCreateRadio ("", 80,30)
GUICtrlSetOnEvent(-1, "radio1")
$radio2 = GUICtrlCreateRadio ("", 80,50)
GUICtrlSetOnEvent(-1, "radio2")

GUISetState(@SW_SHOW)



While 1
    If GUICtrlRead($radio1) = 4 Then
         ControlClick($parent1,"",$radio1)
;~       GUICtrlSetState ($radio1, $GUI_CHECKED);<<<<< problem
    Else
         ControlClick($parent1,"",$radio2)
;~       GUICtrlSetState ($radio2, $GUI_CHECKED);<<<<< problem
    EndIf
    Sleep(1000)
Wend




Func radio1()
    MsgBox(0, "radio1", "ID=" & @GUI_CTRLID & " WinHandle=" & @GUI_WINHANDLE & " CtrlHandle=" & @GUI_CTRLHANDLE)
EndFunc

Func radio2()
    MsgBox(0, "radio2", "ID=" & @GUI_CTRLID & " WinHandle=" & @GUI_WINHANDLE & " CtrlHandle=" & @GUI_CTRLHANDLE)
EndFunc

Func SpecialEvents()
   Exit
EndFunc

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

Thanks alot!!

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  
Followers 0