Jump to content

Controls Blinking


 Share

Recommended Posts

setCtrlData for labels keep blinking if in a loop, where it's still the same characters not changed.And this makes my application so amateur (I'm Amateur but hiding the fact)

any way around that please advice.

Link to comment
Share on other sites

setCtrlData for labels keep blinking if in a loop, where it's still the same characters not changed.And this makes my application so amateur (I'm Amateur but hiding the fact)

any way around that please advice.

Don't know what your loop looks like, but I would do a check to see if the label data needs to be changed and only set the data then, otherwise skip to the next label.
Link to comment
Share on other sites

Ibrahim

Hi! To avoid from control flickering:

1. Use ControlSetText() function instead of GUICtrlSetData() function.

2. Before control text update compare current control text and new text, which you set of a control, and if this both text is different - update your control.

P.S.

Hope you understand my bad english :)

Link to comment
Share on other sites

can u show it with an example simple GUI and Label viewing percent and some text and a progress bar

It's up to the person with the problem to put in at least as much effort as those who are willing to help. IMO you should be able to give a sample of your problem or we could be wasting our time trying to fix the wrong thing. If you think it's simple for someone else to make a sample solution then it must also be simple for you to make a sample problem.
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

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ProgressConstants.au3>
Local $msg

    GUICreate("My GUI") 
    GUISetState(@SW_SHOW) 
$start_btn=GUICtrlCreateButton("Start",10,10,50,30)
$progress=GUICtrlCreateProgress(10,50,150,30,$PBS_SMOOTH )
$label=GUICtrlCreateLabel("Percent",10,90,300,30)



    While 1
        $msg = GUIGetMsg()

        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
         If $msg = $start_btn Then
             for $i = 1 to 500 
            GUICtrlSetData($progress,$i/5)
;~          GUICtrlSetData($label,"Percent is "&$i/5)
            ControlSetText("My GUI","",5,"The Current Percent is "&$i/5)
            sleep(10)
            
        Next
        EndIf
    WEnd
    GUIDelete()

Link to comment
Share on other sites

I cant't see blinking in v. 3.2.12.0

But I can't read the decimal place, because it changes too fast. So you could do checking for No decimal places and only update then:

If IsInt($i/5) Then ControlSetText("My GUI","",5,"The Current Percent is "&$i/5)

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

Ibrahim

Try this:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ProgressConstants.au3>

GUICreate("My GUI") 

$start_btn = GUICtrlCreateButton("Start",10,10,50,30)

$progress = GUICtrlCreateProgress(10,50,150,30,$PBS_SMOOTH )

GUICtrlCreateLabel("Percent: ", 10, 90, 45, 20)

$PercentLabel = GUICtrlCreateLabel("100", 55, 90, 40, 20)

GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $start_btn
            For $i = 1 to 500
                GUICtrlSetData($progress, $i / 500 * 100)
                ControlSetText("My GUI", "", $PercentLabel, Int($i / 5))
                Sleep(10)
            Next
    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...