Jump to content

Clearing GUICtrlCreateGraphic


ACalcutt
 Share

Recommended Posts

Does anyone know how to delete all data that was drawn into a GUICtrlCreateGraphic? I am graphing data and would like clear the graphic window every cycle so it can redraw the changing data.

I had this sort of working by deleting the control and recreating the GUICtrlCreateGraphic control, but there must be a better way to do this, and i don't think it would work with my current GUI

-Andrew

Andrew Calcutt

Http://www.Vistumbler.net

Http://www.TechIdiots.net

Its not an error, its a undocumented feature

Link to comment
Share on other sites

  • 1 month later...

Hi,

#include <GUIConstants.au3>

Global $Graphic

$Gui = GUICreate(";-)", 120, 140)
$Button = GUICtrlCreateButton("Delete Graphic", 15,115, 90, 20)
Graphic()
GUISetState(@SW_SHOW, $Gui)

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $Button
            If $Graphic <> 0 Then
                GUICtrlDelete($Graphic)
                GUICtrlSetData($Button, "Create Graphic")
                $Graphic = 0
            Else
                Graphic()
                GUICtrlSetData($Button, "Delete Graphic")
            EndIf
    EndSelect
WEnd

Func Graphic()
    $Graphic = GuiCtrlCreateGraphic(10, 10, 100,100)
    GUICtrlSetBkColor(-1,0xffffff)
    GUICtrlSetColor(-1,0)
    GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0xff0000,0xff0000)
    GUICtrlSetGraphic(-1,$GUI_GR_PIE, 50,50, 40,30,270)
    GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0x00ff00,0xffffff)
    GUICtrlSetGraphic(-1,$GUI_GR_PIE, 58,50, 40,-60,90)
    GUICtrlSetState(-1, $GUI_SHOW)
EndFunc

Cheers

Link to comment
Share on other sites

  • 4 weeks later...

Hi,

#include <GUIConstants.au3>

Global $Graphic

$Gui = GUICreate(";-)", 120, 140)
$Button = GUICtrlCreateButton("Delete Graphic", 15,115, 90, 20)
Graphic()
GUISetState(@SW_SHOW, $Gui)

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $Button
            If $Graphic <> 0 Then
                GUICtrlDelete($Graphic)
                GUICtrlSetData($Button, "Create Graphic")
                $Graphic = 0
            Else
                Graphic()
                GUICtrlSetData($Button, "Delete Graphic")
            EndIf
    EndSelect
WEnd

Func Graphic()
    $Graphic = GuiCtrlCreateGraphic(10, 10, 100,100)
    GUICtrlSetBkColor(-1,0xffffff)
    GUICtrlSetColor(-1,0)
    GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0xff0000,0xff0000)
    GUICtrlSetGraphic(-1,$GUI_GR_PIE, 50,50, 40,30,270)
    GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0x00ff00,0xffffff)
    GUICtrlSetGraphic(-1,$GUI_GR_PIE, 58,50, 40,-60,90)
    GUICtrlSetState(-1, $GUI_SHOW)
EndFunc

Cheers

Is there any way to do it without deleting the graphic? I am deleting it now, but when my graph gets big you can set the flash of the graph deleting and recreating itself. Its a little annoying

Andrew Calcutt

Http://www.Vistumbler.net

Http://www.TechIdiots.net

Its not an error, its a undocumented feature

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