Jump to content
Sign in to follow this  
gseller

Radio trouble $GUI_CHECKED trouble...

Recommended Posts

gseller

Hey All, I am wanting to start a timezone calculator or converter. and I want to get the current DST/CST as radio buttons on my converter. I have what looks to work but I want the radio buttons to be able to be selected by the user if converting the other choice. Anyway, my gui is selecting the right radio button but wth the $GUI_CHECKED will not allow the other radio to be selected if a user wants to. can someone offer any advise?

#include <GUIConstants.au3>
#include <Date.au3>

#Region ### START Koda GUI section ### Form=J:\000 - Autoit Rogue FIles\Autoit Tools\koda_2007.07.07\Forms\dst - cst.kxf
$TZInfo = GUICreate("Timezone", 123, 74, 193, 125)
$Group1 = GUICtrlCreateGroup("Time Zone Info", 8, 8, 105, 57)
$Radio1 = GUICtrlCreateRadio("DS", 16, 32, 33, 25)
$Radio2 = GUICtrlCreateRadio("ST", 56, 32, 33, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
    ; Get current time zone information
    $TZ = _Date_Time_GetTimeZoneInformation ()
If $TZ <= 1 Then
 GUICtrlSetState($Radio1, $GUI_CHECKED)
Else
 GUICtrlSetState($Radio2, $GUI_CHECKED)
EndIf
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit

EndSwitch
WEnd

Share this post


Link to post
Share on other sites
AdmiralAlkex

Do you really need to update the radios on every loop? Why not do it once before entering the loop, OR show it on a label if you really need it to constantly update.

Share this post


Link to post
Share on other sites
gseller

SWEET!! That was the answer.. LOL DUH on my part.. Thanks for replying.. Here is my fix... :) Sometinmes I just look at this stuff too long...

#include <GUIConstants.au3>
#include <Date.au3>

#Region ### START Koda GUI section ### Form=J:\000 - Autoit Rogue FIles\Autoit Tools\koda_2007.07.07\Forms\dst - cst.kxf
$TZInfo = GUICreate("Timezone", 123, 74, 193, 125)
$Group1 = GUICtrlCreateGroup("Time Zone Info", 8, 8, 105, 57)
$Radio1 = GUICtrlCreateRadio("DS", 16, 32, 33, 25)
$Radio2 = GUICtrlCreateRadio("ST", 56, 32, 33, 25)

    ; Get current time zone information
    $TZ = _Date_Time_GetTimeZoneInformation ()
If $TZ <= 1 Then
 GUICtrlSetState($Radio1, $GUI_CHECKED)
Else
 GUICtrlSetState($Radio2, $GUI_CHECKED)
EndIf

GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit

EndSwitch
WEnd

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  

×