Jump to content

Hide Graphic Control?


Recommended Posts

Doesn't that mean I would have to recreate it? I just want to hide the control for a bit of time.

Either you delete it and then recreate it or you hide it by putting something in front. If the background is just plain then it is fairly easy to hide it.

$gp = ControlGetPos($hWnd,'',$grapicID])
$labHide1 = GUICtrlCreateLabel("",$gp[0],$gp[1],$gp[2],$gp[3])
GUICtrlSetState(-1,$GUI_DISABLE)

The you can hide or show the label to show or hide the graphic.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Either you delete it and then recreate it or you hide it by putting something in front. If the background is just plain then it is fairly easy to hide it.

$gp = ControlGetPos($hWnd,'',$grapicID])
$labHide1 = GUICtrlCreateLabel("",$gp[0],$gp[1],$gp[2],$gp[3])
GUICtrlSetState(-1,$GUI_DISABLE)

The you can hide or show the label to show or hide the graphic.

Alright thanks for the suggestion.
Link to comment
Share on other sites

Another option is to create the graphic as ctrl in a childGUI of the main GUI and then simply show/hilde the child GUI.

#include <WindowsConstants.au3>
#include <GuiConstants.au3>
#include <WinAPI.au3>


Global $h_MainGUI, $h_Graphic_ChildGUI, $c_Graphic, $c_btn_ShowHideGraphic, $f_IsGraphicHidden

$h_MainGUI = GUICreate("Show/Hide a Graphic control", 400, 300)

; Create a child GUI at the place we want to put our graphic control (e.g at 20,50,100,100)
$h_Graphic_ChildGUI=GUICreate('',100,100,20, 50, BitOr($WS_CHILD,$WS_TABSTOP),-1,$h_MainGUI)
; Create graphic control as a ctrl of $h_Graphic_ChildGUI. Place it at 0,0
$c_Graphic=GUICtrlCreateGraphic(0, 0, 100,100)
GUISetState()

; switch back to $h_MainGUI
GUISwitch($h_MainGUI)

; Create more ctrls
$c_btn_ShowHideGraphic = GuiCtrlCreateButton("Hide", 140,60,100,20)

; Use a flag to keep track of visibility of our graphic
$f_IsGraphicHidden = FALSE

;Draw something in graphic area
GUICtrlSetColor($c_Graphic,0x00d0d0)
GUICtrlSetGraphic($c_Graphic,$GUI_GR_COLOR, 0xff0000,0xff0000)
GUICtrlSetGraphic($c_Graphic,$GUI_GR_PIE, 50,50, 40,30,270)

GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $c_Graphic
            MsgBox(0, 'Graphic Event', 'CLICKed on graphic!')
            
        Case $c_btn_ShowHideGraphic
            
            if $f_IsGraphicHidden Then
                GuiSetState(@SW_SHOW, $h_Graphic_ChildGUI)
                GuiCtrlSetData($c_btn_ShowHideGraphic, "Hide")
                
                $f_IsGraphicHidden = FALSE
            Else
                GuiSetState(@SW_HIDE, $h_Graphic_ChildGUI)
                GuiCtrlSetData($c_btn_ShowHideGraphic, "Show")
                $f_IsGraphicHidden = TRUE
            EndIf
                
        Case Else
            ;;;;
    EndSwitch
WEnd
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...