Jump to content

Tab - Flickering Control after update


Tankbuster
 Share

Recommended Posts

Hello,

could someone explain why the control $labelOnTab2 in the example below flickers when the mouse is moved?

As soon as the control is updated it starts to flicker (at least on two systems)

I re-used the example and modified it to demonstrate. I hope you could see the effect.

To reproduce:

Start script.

move mouse / expect: nothing will flicker

wait at least one minute until $labelOnTab2 is once updated

move mouse / expect: control will flicker

change tab

now also "label1" and "label0" (using the same coordinates) will flicker.

Is this a problem of the while loop catching the $msg?

#include <GUIConstantsEx.au3>

Example()

Func Example()
    Local $msg

    GUICreate("My GUI Tab") ; will create a dialog box that when displayed is centered

    GUISetBkColor(0x00E0FFFF)
    GUISetFont(9, 300)

    GUICtrlCreateTab(10, 10, 200, 100)

    GUICtrlCreateTabItem("tab0")
    GUICtrlCreateLabel("label0", 30, 80, 50, 20)
    GUICtrlCreateButton("OK0", 20, 50, 50, 20)
    GUICtrlCreateInput("default", 80, 50, 70, 20)

    GUICtrlCreateTabItem("tab----1")
    GUICtrlCreateLabel("label1", 30, 80, 50, 20)
    GUICtrlCreateCombo("", 20, 50, 60, 120)
    GUICtrlSetData(-1, "Trids|CyberSlug|Larry|Jon|Tylo", "Jon") ; default Jon
    GUICtrlCreateButton("OK1", 80, 50, 50, 20)

    GUICtrlCreateTabItem("tab2")
    GUICtrlSetState(-1, $GUI_SHOW) ; will be display first
    $labelOnTab2=GUICtrlCreateLabel(@MIN, 30, 80, 50, 20)
    GUICtrlCreateButton("OK2", 140, 50, 50)

    GUICtrlCreateTabItem("") ; end tabitem definition

    GUICtrlCreateLabel("label3", 20, 130, 50, 20)

    GUISetState()
    $lastSec=@MIN
    ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
        ConsoleWrite(@MIN&":"&$lastSec&@LF)
        if $lastSec <> @MIN Then
            guictrlsetdata($labelOnTab2,@MIN)
        EndIf
    WEnd
EndFunc   ;==>Example
Link to comment
Share on other sites

  • Moderators

Tankbuster,

You need to reset the $lastSec variable to match the new content of the label or else the comparison fires on every pass through the loop after the first update: ;)

If $lastSec <> @MIN Then
    GUICtrlSetData($labelOnTab2, @MIN)
    $lastSec = @MIN ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
EndIf
The other labels flickered because they share the same location and the entire GUI is rewritten when there is a change to one of the controls. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Oh, yes the forgotten set of the $lastsec I missed in my example (in my real app it was there, sorry... - I'm a :idiot: )

And now it works. But one question that was actually the root cause of the post:

If on Windows 7 the style is set to "Windows basic" (no aero) it is flickering.

Same script on Aero Style DOES NOT flicker, but I guess the answer "..entire GUI is rewritten..." is differently handled by windows in these two styles, right?

#include <GUIConstantsEx.au3>

Example()

Func Example()
    Local $msg

    GUICreate("My GUI Tab") ; will create a dialog box that when displayed is centered

    GUISetBkColor(0x00E0FFFF)
    GUISetFont(9, 300)

    GUICtrlCreateTab(10, 10, 200, 100)

    GUICtrlCreateTabItem("tab0")
    GUICtrlCreateLabel("label0", 30, 80, 50, 20)
    GUICtrlCreateButton("OK0", 20, 50, 50, 20)
    GUICtrlCreateInput("default", 80, 50, 70, 20)

    GUICtrlCreateTabItem("tab----1")
    GUICtrlCreateLabel("label1", 30, 80, 50, 20)
    GUICtrlCreateCombo("", 20, 50, 60, 120)
    GUICtrlSetData(-1, "Trids|CyberSlug|Larry|Jon|Tylo", "Jon") ; default Jon
    GUICtrlCreateButton("OK1", 80, 50, 50, 20)

    GUICtrlCreateTabItem("tab2")
    GUICtrlSetState(-1, $GUI_SHOW) ; will be display first
    $labelOnTab2=GUICtrlCreateLabel(@SEC, 30, 80, 50, 20)
    GUICtrlCreateButton("OK2", 140, 50, 50)

    GUICtrlCreateTabItem("") ; end tabitem definition

    GUICtrlCreateLabel("label3", 20, 130, 50, 20)

    GUISetState()
    $lastSec=@SEC
    ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
        ConsoleWrite(@SEC&":"&$lastSec&@LF)
        if $lastSec <> @SEC Then
            $lastsec = @SEC
            guictrlsetdata($labelOnTab2,$lastsec)

        EndIf
    WEnd
EndFunc   ;==>Example

Modified script (with seconds now)

To reproduce:

set win7 to AERO (default windows)

start script

change tab to "tab0"  / expecting text "label0" is not flickering

stop script

set Win7 to Windows basic (no aero)

start script

change tab to "tab0"  / expecting text "label0" is flickering from time to time (not every update...)

Does this makes sense?

Only the control that shares the location on the screen with the updated control in a second tab is flickering when the simple windows style is used...

Edited by Tankbuster
Link to comment
Share on other sites

  • Moderators

Tankbuster,

I do not run Win7 so I cannot comment, sorry. :(

M23

Edit: I misled you earlier. It is not the whole GUI that is redrawn, it is just the area of screen affected by the control being updated - but the rewriting of that control flickers that area on the screen so any other controls in the same place (on another tab for example) will also flicker as that area is rewritten.

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Ok, this makes sense. Because as I wrote the flickering affects only the area of the changed text.

btw: My solution was to move the updating control to a area that is not shared with other tabs. I just wanted to knwo if others do also see this behavior or if this is limited to certain configs/windows and so on.

Thx for trying.

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