n1maS Posted November 2, 2012 Share Posted November 2, 2012 hey all is there any way to create such lable that does not flicker? checkout the example below #include #include HotKeySet("{ESC}", "_Exit") ; =============== ; Test #1 ; =============== $hGUI = GUICreate("Test", 300, 200) $iPic = GUICtrlCreatePic(".\SS.jpg", 0, 0, 300, 200) $iLable = GUICtrlCreateLabel("", 70, 50, 100, 20, $SS_CENTER) GUICtrlSetFont($iLable, 10, 400, 0, "Segoe Script") GUICtrlSetBkColor($iLable, $GUI_BKCOLOR_TRANSPARENT) GUISetState() While Sleep(20) GUICtrlSetData($iLable, Random(0, 100000, 1)) WEnd Func _Exit() Exit EndFunc ;==>_Exit I need to change the data a lot thats why I made the example this way. is there any other way exepet using $WS_EX_COMPOSITED ? tnx Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 2, 2012 Moderators Share Posted November 2, 2012 n1maS, Do you really need to change the data that often? I cannot even read the value when it is changing every 20ms! If I slow down the script to write every 250ms I get no flickering at all - and I can read the value displayed without 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...
n1maS Posted November 2, 2012 Author Share Posted November 2, 2012 Melba23, first of all thanks for your quick reply. (as always!) Well, not that often! but I need to change it fast. even if I slow it down to 250ms, I get flickering. (Every 5-10 sec) Is it possible to use double buffering? Link to comment Share on other sites More sharing options...
stormbreaker Posted November 3, 2012 Share Posted November 3, 2012 For such purpose (to avoid flickring) you will need ControlSetText()#include <WindowsConstants.au3> #include <GuiConstantsEx.au3> HotKeySet("{ESC}", "_Exit") ; =============== ; Test #1 ; =============== $hGUI = GUICreate("Test", 300, 200) $iPic = GUICtrlCreatePic(".SS.jpg", 0, 0, 300, 200) $iLable = GUICtrlCreateLabel("", 70, 50, 100, 20) GUICtrlSetFont($iLable, 10, 400, 0, "Segoe Script") GUICtrlSetBkColor($iLable, $GUI_BKCOLOR_TRANSPARENT) GUISetState() While Sleep(250) ControlSetText($hGUI, "", $iLable, Random(0, 100000, 1), 1) WEnd Func _Exit() Exit EndFunc ;==>_Exit ---------------------------------------- :bye: Hey there, was I helpful? ---------------------------------------- My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1 Link to comment Share on other sites More sharing options...
n1maS Posted November 3, 2012 Author Share Posted November 3, 2012 In that case, the whole GUI flickers! try it yourself and see the result Link to comment Share on other sites More sharing options...
UEZ Posted November 3, 2012 Share Posted November 3, 2012 (edited) You can use a child GUI. Example: #include <WinAPI.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <GUIConstantsEx.au3> HotKeySet("{ESC}", "_Exit") ; =============== ; Test #1 ; =============== $hGUI = GUICreate("Test", 300, 200) $iPic = GUICtrlCreatePic(".SS.jpg", 0, 0, 300, 200) GUICtrlSetState(-1, $GUI_DISABLE) $hGUI_Child = GUICreate("", 100, 20, 70, 50, $WS_POPUP, $WS_EX_MDICHILD + $WS_EX_TOPMOST + $WS_EX_LAYERED + $WS_EX_TRANSPARENT + $WS_EX_COMPOSITED, $hGUI) $iTransCol = 0x808080 GUISetBkColor($iTransCol, $hGUI_Child) $iLable = GUICtrlCreateLabel("", 0, 0, 100, 20, $SS_CENTER) GUICtrlSetFont($iLable, 10, 400, 0, "Segoe Script", 5) GUICtrlSetBkColor($iLable, $GUI_BKCOLOR_TRANSPARENT) _WinAPI_SetLayeredWindowAttributes($hGUI_Child, $iTransCol) GUISetState(@SW_SHOW, $hGUI) GUISetState(@SW_SHOWNA, $hGUI_Child) While Sleep(20) GUICtrlSetData($iLable, Random(0, 100000, 1)) WEnd Func _Exit() GUIDelete($hGUI_Child) GUIDelete($hGUI) Exit EndFunc ;==>_Exit Br, UEZ Edited November 3, 2012 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...
KaFu Posted November 3, 2012 Share Posted November 3, 2012 Well, for me the child gui does not seem to be treated as a real child, as when the parent goes to the background the child still stays on top (at least on Win7, guess it has something to do with the style mix (layered?) ) ?! expandcollapse popup#include <WinAPI.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <GUIConstantsEx.au3> HotKeySet("{ESC}", "_Exit") ; =============== ; Test #1 ; =============== $hGUI = GUICreate("Test", 300, 200) $iPic = GUICtrlCreatePic(".ss.jpg", 0, 0, 300, 200) GUICtrlSetState(-1, $GUI_DISABLE) $hGUI_Child = GUICreate("", 100, 20, 70, 50, $WS_POPUP, BitOR($WS_EX_MDICHILD,$WS_EX_TOPMOST, $WS_EX_LAYERED, $WS_EX_TRANSPARENT ,$WS_EX_COMPOSITED), $hGUI) $iTransCol = 0x808080 GUISetBkColor($iTransCol, $hGUI_Child) $iLable = GUICtrlCreateLabel("", 0, 0, 100, 20, $SS_CENTER) GUICtrlSetFont($iLable, 10, 400, 0, "Segoe Script", 5) GUICtrlSetColor($iLable,0xff0000) GUICtrlSetBkColor($iLable, $GUI_BKCOLOR_TRANSPARENT) _WinAPI_SetLayeredWindowAttributes($hGUI_Child, $iTransCol) GUIRegisterMsg($WM_ACTIVATE, "WM_ACTIVATE") GUISetState(@SW_SHOW, $hGUI) While Sleep(20) GUICtrlSetData($iLable, Random(0, 100000, 1)) WEnd Func _Exit() GUIDelete($hGUI_Child) GUIDelete($hGUI) Exit EndFunc ;==>_Exit Func WM_ACTIVATE($hWnd, $Msg, $wParam, $lParam) Switch $hWnd Case $hGUI If $wParam Then GUISetState(@SW_SHOWNA, $hGUI_Child) Else GUISetState(@SW_HIDE, $hGUI_Child) endif EndSwitch Return $GUI_RUNDEFMSG EndFunc OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
UEZ Posted November 3, 2012 Share Posted November 3, 2012 (edited) @KaFu: for me when the GUI loses the focus the child window is hidden and is visible when window is active again. I'm using Win7 x64 with Aero. Edit: now I got you. Indeed when activating another window the child window is still on top! I wasn't aware of this... good catch! In this case don't use $WS_EX_TOPMOST because it is not needed or your workaround! Br, UEZ Edited November 3, 2012 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...
n1maS Posted November 3, 2012 Author Share Posted November 3, 2012 UEZ, it worked fine, thanks I agree with KaFu. I'm using Win7 x64 too. well WM_ACTIVATE seems to be a good option. thank you both. Link to comment Share on other sites More sharing options...
LeCarre Posted August 1, 2014 Share Posted August 1, 2014 (edited) Tried to implement this into my flickering window, spent hours on it, but it fuzzes up my fonts pretty bad, when I change the Transparent color from 0x808080 to 0xFF0000 it shows that the transparent color appears like an aura around the font, it's just less obvious with the Grey 0x808080 and the more artistic font... Trying a thin font looks like pretty bad. well, flickering is my friend Edited August 2, 2014 by LeCarre Link to comment Share on other sites More sharing options...
topten Posted May 5, 2016 Share Posted May 5, 2016 The method of adding Child_gui helps avoiding flickering, but how can I access control behind the child_gui ? GUICtrlSetCursor(-1, 0) GUICtrlSetOnEvent($iLable, "somefunc") Link to comment Share on other sites More sharing options...
AutoBert Posted May 5, 2016 Share Posted May 5, 2016 GuiCtrlSetData works with control behind a child gui: expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Add_Constants=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.6.1 Author: AutoBert: http://www.autoit.de/index.php?page=Thread&postID=164341#post164341 Skriptbeispiel für den Umgang mit INI-Files und ComboBox #ce ---------------------------------------------------------------------------- #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GuiComboBox.au3> #include <StaticConstants.au3> #include <Array.au3> Const $sElect = "bitte einen Download auswählen" Global $sUrl ;ausgewählte DownloadUrl Global $sIni = @AppDataDir & "\Download.INI" ;Pfad zur Inidatei Global $sLocalFolder ;letztes Verzeichnis in das gespeichert wurde Global $aData[3] ;Download-Infos Global $iFileSize ;Grösse des DL-Files Global $tStart ;Download gestartet Global $nKBPerSec ;KB pro Sekunde Global $iPercent ;aktuell heruntergeladenen Prozentanteil der Datei ;FileDelete($sIni) If Not FileExists($sIni) Then $sData = "AutoIt 3.3.14.2=https://www.autoitscript.com/cgi-bin/getfile.pl?autoit3/autoit-v3-setup.exe" $sData &= "|This is actual stable version<CRLF>It's recommended to use it"& @LF $sData &= "AutoIt Beta=https://www.autoitscript.com/forum/files/file/351-learn-to-program-using-free-tools-with-autoit/?do=download&csrfKey=46ede52eb772decda8c95753f0fe98c4" $sData &= "|This is a beta version<CRLF>Only excperts should use it"& @LF IniWriteSection($sIni, "URLs", $sData) EndIf $hGui = GUICreate("mini-Downloader", 300, 125, 302, 218) $idcboProg = GUICtrlCreateCombo("", 8, 8, 200, 25) $idbtnAdd = GUICtrlCreateButton("&Hinzufügen", 213, 8, 80) $idbtnDel = GUICtrlCreateButton("&Löschen", 213, 35, 80) $idprgInfo = GUICtrlCreateProgress(8, 70, 285, 30) $idbtnDL = GUICtrlCreateButton("&Downloaden", 8, 35, 200) $idMultiLine=GUICtrlCreateEdit("",8,65,285,50,$ES_ReadOnly) $hGUI_c = GUICreate("", 184, 30, 8, 73, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TRANSPARENT, $WS_EX_MDICHILD), $hGUI) GUISetBkColor(0x989898, $hGUI_c) $idlblInfo = GUICtrlCreateLabel("0", 0, 0, 184, 25, $ES_CENTER) GUICtrlSetFont(-1, 12, 1000) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) _WinAPI_SetLayeredWindowAttributes($hGUI_c, 0x989898) GUICtrlSetState($idlblInfo, $GUI_HIDE) GUICtrlSetState($idprgInfo, $GUI_HIDE) read_INI() GUISetState(@SW_SHOW, $hGUI) GUISetState(@SW_SHOWNA, $hGUI_c) HttpSetUserAgent("Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.2.7) Gecko/20100713 Firefox/3.6.16") ;sonst streiken manche Freehoster wenn der AutoItUseragent gesetzt ist While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE IniWrite($sIni, "Path", "Local", $sLocalFolder) Exit #cs Case $idbtnAdd $write1 = InputBox("Downloadadresse", "Bitte eine gültige Download-Adresse eingeben") If $write1 <> "" Then $write2 = InputBox("Download verwalten unter", "Bitte Kurzbegriff eingeben") If $write2 <> "" Then IniWrite($sIni, "URLs", $write2, $write1) GUICtrlSetData($idcboProg, $write2, $write2) EndIf get_Selection() Case $idbtnDel $sDel = GUICtrlRead($idcboProg) IniDelete($sIni, "URLs", $sDel) GUICtrlSetData($idcboProg, "") read_INI() #ce Case $idcboProg get_Selection() Case $idbtnDL ;get_Selection() $bCanceld = False GUICtrlSetState($idMultiLine, $GUI_HIDE) GUICtrlSetData($idbtnDL, "Download &abbrechen") $aDatei = StringSplit($sUrl, "/") $sDatei = $aDatei[$aDatei[0]] $sLocal = FileSaveDialog($sDatei & "Speichern unter", $sLocalFolder, "Alle (*.*)", 18, $sDatei, $hGui) If Not @error Then GUICtrlSetState($idprgInfo, $GUI_SHOW) GUICtrlSetState($idlblInfo, $GUI_SHOW) GUICtrlSetData($idlblInfo, "Download startet") $aTmp = StringSplit($sLocal, "\") $sLocalFolder = $aTmp[$aTmp[1]] $iFileSize = InetGetSize($sUrl) $hDL = InetGet($sUrl, $sLocal, 1, 1) $tStart = TimerInit() $aData[0] = 0 Do $bCanceld = _MySleep(500) If $bCanceld Then ExitLoop $aData = InetGetInfo($hDL, -1) If $aData[0] > 0 Then $tDiff = TimerDiff($tStart) $nKBPerSec = Round($aData[0] / $tDiff * 1000 / 1024, 2) $iPercent = Round($aData[0] / $iFileSize * 100, 2) If GUICtrlRead($idlblInfo) <> $iPercent Then GUICtrlSetData($idprgInfo, $iPercent) GUICtrlSetData($idlblInfo, $iPercent & " % " & $nKBPerSec & " KB/sec") WinSetTitle($hGui, "", "DL: " & $sDatei & " " & $iPercent & "%") EndIf EndIf Until $aData[2] InetClose($hDL) ;_ArrayDisplay($aData) If $aData[0] < $aData[1] Then $aData[3] = False ;dummerweise werden nur DL-Fehler auf meiner Seite erkannt es kommt aber vo das der DL aus anderen Gründen nicht erfolgreich war If $aData[0] < $iFileSize Then $aData[3] = False ;dummerweise werden nur DL-Fehler auf meiner Seite erkannt es kommt aber vo das der DL aus anderen Gründen nicht erfolgreich war If Not $aData[3] Then If $bCanceld Then $sMsg = "Download wurde durch Benutzer abgebrochen" Else $sMsg = "Download hat abgebrochen," & @CRLF & "überprüfen sie Ihre Internetverbindung." & @CRLF & @CRLF & "Probieren Sie danach noch einmal!" EndIf MsgBox(48, "Fehler:", $sMsg) FileDelete($sLocal) Else GUICtrlSetState($idbtnDL, $GUI_DISABLE) GUICtrlSetData($idcboProg,$sElect,$sElect) MsgBox(64, $sLocal, "erfolgreich heruntergeladen") EndIf GUICtrlSetState($idMultiLine, $GUI_SHOW) Else MsgBox(48, "Fehler:", "keinen Namen zum Speichern ausgeählt") EndIf GUICtrlSetData($idprgInfo, 0) GUICtrlSetData($idlblInfo, 0) GUICtrlSetState($idlblInfo, $GUI_HIDE) GUICtrlSetState($idprgInfo, $GUI_HIDE) GUICtrlSetData($idbtnDL, "&Downloaden") WinSetTitle($hGui, "", "mini-Downloader") EndSwitch WEnd Func _MySleep($iMSec) Local $nMsg, $dt = TimerInit() Do $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $idbtnDL Return 1; DL Abbrechen wurde gedrückt EndSwitch Sleep(10) Until TimerDiff($dt) > $iMSec EndFunc ;==>_MySleep Func read_INI() $list1 = IniReadSection($sIni, "URLs") ;ConsoleWrite($list1 & @CRLF) If IsArray($list1) Then For $i = 1 To $list1[0][0] GUICtrlSetData($idcboProg, $list1[$i][0]) Next EndIf _GUICtrlComboBox_InsertString($idcboProg, $sElect, 0) _GUICtrlComboBox_SetCurSel($idcboProg, 0) $sLocalFolder = IniRead($sIni, "Path", "Local", @ScriptDir) EndFunc ;==>read_INI Func get_Selection() If GUICtrlRead($idcboProg) = $sElect Then GUICtrlSetState($idbtnDL, $GUI_DISABLE) GUICtrlSetData($idlblInfo, "") GUICtrlSetData($idMultiLine, "") Else GUICtrlSetState($idbtnDL, $GUI_ENABLE) $Prog = GUICtrlRead($idcboProg) ;ConsoleWrite("ausgewählt: " & $Prog & @CRLF) $sTmp = IniRead($sIni, "URLs", $Prog, "") $aTmp=StringSplit($sTmp,"|") ;_ArrayDisplay($aTmp) $sUrl=$aTmp[1] GUICtrlSetData($idMultiLine,StringReplace($aTmp[2],"<CRLF>",@CRLF)) EndIf EndFunc ;==>get_Selection what you would ask with your snipet, i don't understand. 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