Jump to content

Stop my Labels flickering


Recommended Posts

hello

i have a script where i have

While 1
   _zz()
Wend

Func _zz()
   GUICtrlSetData($v, Round($Value,2))
   GUICtrlSetData($h, Round($Value,2))
   GUICtrlSetData($p, Round($Value,2))
   GUICtrlSetData($j, Round($Value,2))
   GUICtrlSetData($k, Round($Value,2))
   GUICtrlSetData($l, Round($Value,2))
   GUICtrlSetData($n, Round($Value,2)) 
   GUICtrlSetData($b, Round($Value,2))
EndFunc

plus other code i left out, i know its constantly flickering because it updates the labels (thats what its setting) like 4 times a second or sumthing but is there a way i can stop it =)

qq

Link to comment
Share on other sites

hello

i have a script where i have

While 1
   _zz()
Wend

Func _zz()
   GUICtrlSetData($v, Round($Value,2))
   GUICtrlSetData($h, Round($Value,2))
   GUICtrlSetData($p, Round($Value,2))
   GUICtrlSetData($j, Round($Value,2))
   GUICtrlSetData($k, Round($Value,2))
   GUICtrlSetData($l, Round($Value,2))
   GUICtrlSetData($n, Round($Value,2)) 
   GUICtrlSetData($b, Round($Value,2))
EndFunc

plus other code i left out, i know its constantly flickering because it updates the labels (thats what its setting) like 4 times a second or sumthing but is there a way i can stop it =)

<{POST_SNAPBACK}>

Put some sleep statments in...

CheersNobby

Link to comment
Share on other sites

You could try to check if the values have changed and only update if so.

<{POST_SNAPBACK}>

An example of this:

If GuiCtrlGetData($v) <> Round($Value, 2) Then GUICtrlSetData($v, Round($Value,2))
   If GuiCtrlGetData($h) <> Round($Value, 2) Then GUICtrlSetData($h, Round($Value,2))
   If GuiCtrlGetData($p) <> Round($Value, 2) Then GUICtrlSetData($p, Round($Value,2))
   If GuiCtrlGetData($j) <> Round($Value, 2) Then GUICtrlSetData($j, Round($Value,2))
   If GuiCtrlGetData($k) <> Round($Value, 2) Then GUICtrlSetData($k, Round($Value,2))
   If GuiCtrlGetData($l) <> Round($Value, 2) Then GUICtrlSetData($l, Round($Value,2))
   If GuiCtrlGetData($n) <> Round($Value, 2) Then GUICtrlSetData($n, Round($Value,2))
   If GuiCtrlGetData($b) <> Round($Value, 2) Then GUICtrlSetData($b, Round($Value,2))
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to comment
Share on other sites

Sounds to me like the other code you left out contains a background(0x00######) marker. If it does, that's why it's flickering. Remove the background color and it won't flicker.

Otherwise, it hits the background color first and then goes to grey (if you are using tab or other labels). Not sure if this applies to your situation but it sounds like it could be a possible problem.

[font="Optima"]"Those who heed life with speculation and contemplation, are the ones stuck home with constipation." - Joel[/font]

Link to comment
Share on other sites

Same thing i my scripts (i suppose to be problem in label (with or without If statements))

With label:

#include <GuiConstants.au3>

GUICreate("Label", 169, 44)

$slider = GUICtrlCreateSlider(2, 24, 165, 18)

GUICtrlSetLimit($slider, 100, 0)

GUICtrlSetData($slider, 10)

$num = GUICtrlRead($slider)

$label = GUICtrlCreateLabel("Turn off after: " & $num & " minutes", 2, 4, 165, 15, $SS_SUNKEN)

GUISetState()

While 1

  $msg = GUIGetMsg()

  $num = GUICtrlRead($slider)

  GUICtrlSetData($label, $num)

  If $num < 1 Then

      GUICtrlSetData($label, "Please enter positive value")

  EndIf

  If $num = 1 Then

      GUICtrlSetData($label, "Turn off after: " & $num & " minute")

  EndIf

  If $num > 1 Then

      GUICtrlSetData($label, "Turn off after: " & $num & " minutes")

  EndIf

  Select

      Case $msg = $GUI_EVENT_CLOSE

        Exit

  EndSelect

WEnd

With progress:

#include <GuiConstants.au3>

GUICreate("Progress", 169, 44)

$slider = GUICtrlCreateSlider(2, 24, 165, 18)

GUICtrlSetLimit($slider, 100, 0)

GUICtrlSetData($slider, 10)

$num = GUICtrlRead($slider)

$progress = GUICtrlCreateProgress(2, 4, 165, 15, $PBS_SMOOTH)

GUICtrlSetColor($progress, 0xFF0000)

GUISetState()

While 1

  $msg = GUIGetMsg()

  $num = GUICtrlRead($slider)

  GUICtrlSetData($progress, $num)

  Select

      Case $msg = $GUI_EVENT_CLOSE

        Exit

  EndSelect

WEnd

Link to comment
Share on other sites

ty everyone for replying

my script only updates if the value has changed, it does not flick when it hasnt, and yes i do have a BG colour and text colour of the label, i removed the background colour and the text colour and its still flickered, only a tiny bit.

when i release the final version of my script i will release all the coding plus the bits i left out, the reason im doing this is because i dont want anyone to "steal" my idea ... it may sound childish but i like to complete my script and instead of releasing what i have done so far to the public and having someone see my coding and finish for me. id rather not =)

qq

Link to comment
Share on other sites

what makes this one smooth vs flicker? I look through the code and see only very minor changes.....Might help you too ( then again mabye not :))

SplashTextOn("Title", "Message goes here.", -1, -1, -1, -1, 4, "", 24)
Sleep(3000)
SplashOff()

;; FLICKER
$message = ""
SplashTextOn("TitleFoo", $message, -1, -1, -1, -1, 4, "")
For $x = 1 to 20
    $message = $message & $x & @LF
    SplashTextOn("TitleFoo", $message, -1, -1, -1, -1, 4, "")
    Sleep(100)
Next

;; SMOOTH
$message = ""
SplashTextOn("TitleFoo", $message, -1, -1, -1, -1, 4, "")
For $x = 1 to 20
    $message = $message & $x & @LF
    ControlSetText("TitleFoo", "", "Static1", $message)
    sleep(100)
Next

~Projects~1. iPod Ejector 1.0 - Tool Used To Eject iPod in Windows - Uses DevEject.exe :P2. SmartFTP Close Popup Tool - Closes reminders from freeware SmartFTP.~Helpful Links For New Users~1. LXP's Learning AutoIT PDF Guide - <<< Go here for a PDF Guide on learning AutoIT from the ground up!<<<2. AutoIt 1-2-3 <<<Want to learn more about AutoIT quickly? Go Here<<<3. How To Install The Beta And Production Versions Of AutoIT / SciteAutoIT

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