Jump to content

Graphic won't completely show or hide


Recommended Posts

Building a small app for a touchscreen where keyboard might not be available. This is a portion of the entire code that basically forces the user to set the current time and timezone at first startup. If the user presses "OK" before a choice is made, I want to highlight the field that needs attention.

I've created two rectangles to "frame" the field, one red and one black. I want to show the red one when a choice has not been made, then hide it (returning to the black one) when a choice has been made.

Seems to work except that only the top three-fourths of the red graphic shows up. I've tried hiding the normal black frame as part of the process with no luck.

Am I missing something simple here? Thanks in advance!

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <EditConstants.au3>

Global $TimeZoneChosen = False

Global $MainForm = GUICreate("System Setup", @DesktopWidth, @DesktopHeight)

; -------- Time Zone Section -------------------
Global $TZinput = GUICtrlCreateInput("",175,160,70, 20, BitOR($ES_READONLY,$ES_CENTER))
GUICtrlSetFont($TZinput, 11, 500)
GUICtrlSetBkColor ($TZinput, 0x000000)
GUICtrlSetColor ($TZinput, 0xffffff)
Global $TZE = GUICtrlCreateButton("Eastern", 175, 192, 73, 25)
Global $TZC = GUICtrlCreateButton("Central", 175, 228, 73, 25)
Global $TZM = GUICtrlCreateButton("Mountain", 175, 264, 73, 25)
Global $TZZ = GUICtrlCreateButton("Arizona", 175, 299, 73, 25)
Global $TZP = GUICtrlCreateButton("Pacific", 175, 335, 73, 25)
Global $TZA = GUICtrlCreateButton("Alaskan", 175, 371, 73, 25)
Global $TimeOK = GUICtrlCreateButton("OK", 758, 286, 61, 118)
GUICtrlSetFont($TimeOK, 11, 500)

; Graphic Frames
Global $FrameTZ = GUICtrlCreateGraphic(170, 170)
GUICtrlSetGraphic($FrameTZ, $GUI_GR_RECT, 0, 0, 83, 235)
Global $FrameTZRed = GUICtrlCreateGraphic(170, 170)
GUICtrlSetGraphic($FrameTZRed,$GUI_GR_COLOR, 0xF80606)
GUICtrlSetGraphic($FrameTZRed, $GUI_GR_RECT, 0, 0, 83, 235)
GUICtrlSetState($FrameTZRed, $GUI_HIDE)

Main()


Func Main()
    GUISetState(@SW_SHOW, $MainForm)
    
    While 1
        Local $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                GUIDelete($MainForm)
                ExitLoop

            Case $TZE
                NewTimezone($TZE)
            Case $TZC
                NewTimezone($TZC)
            Case $TZM
                NewTimezone($TZM)
            Case $TZZ
                NewTimezone($TZZ)
            Case $TZP
                NewTimezone($TZP)
            Case $TZA
                NewTimezone($TZA)
            Case $TimeOK
                VerifyTimeDateChange()
                
        EndSwitch
    WEnd
EndFunc ;==> Main

Func NewTimezone($SelectedButton)
    $TimeZoneChosen = True
    GUICtrlSetStyle($TZA, $GUI_SS_DEFAULT_BUTTON)
    GUICtrlSetStyle($TZC, $GUI_SS_DEFAULT_BUTTON)
    GUICtrlSetStyle($TZE, $GUI_SS_DEFAULT_BUTTON)
    GUICtrlSetStyle($TZM, $GUI_SS_DEFAULT_BUTTON)
    GUICtrlSetStyle($TZP, $GUI_SS_DEFAULT_BUTTON)
    GUICtrlSetStyle($TZZ, $GUI_SS_DEFAULT_BUTTON)
    GUICtrlSetStyle($SelectedButton, $BS_FLAT)
    GUICtrlSetBkColor($SelectedButton, 0x00008B)
    GuiCtrlSetColor($SelectedButton, 0xffffff)
    GUICtrlSetData($TZinput,GUICtrlRead($SelectedButton))

EndFunc ; ===> NewTimezone

Func VerifyTimeDateChange()
    GUICtrlSetState($FrameTZRed, $GUI_HIDE)
    If $TimeZoneChosen = False Then GUICtrlSetState($FrameTZRed, $GUI_SHOW)
    
EndFunc ; ==> VerifyTimeDateChange()
Edited by JollyFace
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...