GodForsakenSoul Posted October 19, 2010 Share Posted October 19, 2010 a snippet of my code. Sleep(20) GUICtrlSetData($mg_ctrl_TimeLabel,"Welcome. Today is the "&@MDAY&"."&@MON&"."&@YEAR&". The time is "&@HOUR&":"&@MIN&":"&@SEC) the problem is that it flickers. quite noticeably too. right now i'm trying to set the sleep value to something that is both fast to react to buttons being pressed and not to fast so that the message won't flicker as it updates. i've looked in the obvious (to me) parts of the help file for a solution and have yet to find one. any suggestions? Link to comment Share on other sites More sharing options...
Realm Posted October 19, 2010 Share Posted October 19, 2010 (edited) Hello GodForsakenSoul, I noticed that the smallest increment of time to be displayed is a second, have you tried to increase the Sleep to 1000, maybe even 250, should help to reduce or get rid of the flicker, the flicker is from updating 50x per second at a sleep rate of 20ms Realm Edit: 250ms should not be a large pause while waiting for a button to be pressed either. thats 4 checks per second. Edited October 19, 2010 by Realm My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. Link to comment Share on other sites More sharing options...
bogQ Posted October 19, 2010 Share Posted October 19, 2010 (edited) #include <GUIConstantsEx.au3> GUICreate("My GUI") $sec = @SEC $mg_ctrl_TimeLabel = GUICtrlCreateLabel("", 10, 30, "500") GUISetState() Do $msg = GUIGetMsg() If $sec <> @SEC Then $sec = @SEC GUICtrlSetData($mg_ctrl_TimeLabel,"Welcome. Today is the "&@MDAY&"."&@MON&"."&@YEAR&". The time is "&@HOUR&":"&@MIN&":"&@SEC) EndIf Until $msg = $GUI_EVENT_CLOSE Edited October 19, 2010 by bogQ GoogleGonnaSaveUs 1 TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 19, 2010 Moderators Share Posted October 19, 2010 GodForsakenSoul,The normal trick to prevent this is to change the data only when it needs changing. In this case the @SEC is changing the most rapidly so I would suggest something along these lines (untested):$iSec = 0 ; Start Loop If @SEC <> $iSec Then $iSec = @SEC GUICtrlSetData(.....) EndIf ; End LoopNow you only update when @SEC changes once per second and the flickering should stop. A similar trick can be used if you have to change the state of a control - just check the current state and only change state if required. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
GodForsakenSoul Posted October 19, 2010 Author Share Posted October 19, 2010 as usual, melba comes up with an ingenius solution that was sitting RIGHT THERE under my nose... i'm not sure if i love you or hate you... lol. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 19, 2010 Moderators Share Posted October 19, 2010 GodForsakenSoul, bogQ suggested it as well - so you have a double problem! M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Mat Posted October 19, 2010 Share Posted October 19, 2010 As a generic rule I use: If GUICtrlRead($Ctrl) <> $Data Then GUICtrlSetData($Ctrl, $Data) That means that it won't set the content unless it is different, so no flicker. In this case Melba's right as usual though AutoIt Project Listing Link to comment Share on other sites More sharing options...
UEZ Posted October 19, 2010 Share Posted October 19, 2010 (edited) Here another method: #include <GUIConstantsEx.au3> GUICreate("My GUI") $mg_ctrl_TimeLabel = GUICtrlCreateLabel("", 10, 30, "500") GUISetState() Update() AdlibRegister("Update", 500) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE AdlibUnRegister("Update") Exit Func Update() GUICtrlSetData($mg_ctrl_TimeLabel,"Welcome. Today is the "&@MDAY&"."&@MON&"."&@YEAR&". The time is "&@HOUR&":"&@MIN&":"&@SEC) EndFunc But it still flickers sometimes -> bogQ example is much better. Br, UEZ Edited October 19, 2010 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now