Jump to content

question about Graphic controls


 Share

Recommended Posts

So... Why does a refresh command to control 2 also make control 1 refresh?

To battle the flickering in my AutoIt Analog/Digital Alarm Clock that I wrote this weekend and posted on the examples forum, I wrote my code to use multiple separately spaced Graphic controls. This so I could separately refresh the second dial or the digital time indication LED's that I built, so in turn only the changed Graphic control would flicker. Since it would flicker only when it changes, it would be acceptible als also less discernible.

But, after some work, it turned out that it didn't make a difference. So I wrote a small reproducer that creates two separate Graphic controls on a GUI, then fills them up with an overload of random Pie charts (to make it nice and heavy and obvious), then sends some refresh commands to the second control... Since it takes about .2 seconds to refresh (on my machine which is a very low end cheap 64 bits CPU with maybe say 2 bits of cache...), it is really visible that also the first control refreshes. How do I refresh ONLY a single Control, or why can't I do it?

#include <GUIConstants.au3>

$gui = GUICreate("test",600,400)

$Graphic1 = GUICtrlCreateGraphic(0,0,280,400)
$Graphic2 = GUICtrlCreateGraphic(300,0,280,400)

GUISetBkColor(0x000000)

GUICtrlSetGraphic($Graphic1,$GUI_GR_COLOR,0xFFFFFF,0xFF0000)
GUICtrlSetGraphic($Graphic2,$GUI_GR_COLOR,0x00FF00,0x0000FF)


For $filler1 = 1 To 1000
    GUICtrlSetGraphic($Graphic1,$GUI_GR_PIE,Random(280),Random(400),30,0,$filler1/10)
    GUICtrlSetGraphic($Graphic2,$GUI_GR_PIE,Random(280),Random(400),30,0,$filler1/10)
Next

GUICtrlSetGraphic($Graphic1,$GUI_GR_REFRESH)
GUICtrlSetGraphic($Graphic2,$GUI_GR_REFRESH)

GUISetState()

For $loop = 1 To 20
    Sleep(500)
    GUICtrlSetGraphic($Graphic2,$GUI_GR_REFRESH)
Next

MsgBox(0,0,"exit")

Roses are FF0000, violets are 0000FF... All my base are belong to you.

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