Jump to content

Flicker Free Labels


Beege
 Share

Recommended Posts

My Function works on Windows 7 x64 with Aero.

Edit: OK, seems you probably got it working from browsing the posts.

Edited by guinness

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Ya that looks good. The only objection I have is automatically registering WM_PAINT. If the user needs to use it in his script or has another UDF that uses WM_PAINT then hes screwed. Id rather set up a function that they can call to register it if they dont need it, and also give them instructions on how to pass the msg if they do need to use it.

; #FUNCTION# ====================================================================================================
; Name...........:  _GUICtrlFFLabel_RegisterMsgs
; Description....:  
; Syntax.........:  _GUICtrlFFLabel_RegisterMsgs()
; Parameters.....:  None.
; Return values..:  Success - 
;                   Failure - 
; Author.........:  Brian J Christy
; Remarks........:  If $WM_PAINT OR $WM_NCPAINT are needed in your script you MUST pass the msgs to __GUICtrlFFLabel_WM_PAINT.
                                
;                       ex:     
;                               GUIRegisterMsg($WM_PAINT, "_Your_WM_PAINT")
;                               GUIRegisterMsg($WM_PAINT, "_Your_WM_NCPAINT")
;                               
;                               Func _Your_WM_PAINT($hWndGUI, $MsgID, $wParam, $lParam)
;                                   __GUICtrlFFLabel_WM_PAINT()
;                                   ;your code...
;                               EndFunc

;                               Func _Your_WM_NCPAINT($hWndGUI, $MsgID, $wParam, $lParam)
;                                   __GUICtrlFFLabel_WM_PAINT()
;                                   ;your code...
;                               EndFunc                             
; Example........:  
; ===============================================================================================================
Func _GUICtrlFFLabel_RegisterMsgs()
        GUIRegisterMsg($WM_PAINT, "__GUICtrlFFLabel_WM_PAINT"); Register PAINT-Event 0x000F = $WM_PAINT (WindowsConstants.au3)
        GUIRegisterMsg($WM_NCPAINT, "__GUICtrlFFLabel_WM_PAINT") ; $WM_NCPAINT = 0x0085 (WindowsConstants.au3)Restore after Minimize.
EndFunc
Edited by Beege
Link to comment
Share on other sites

My Function GUIGetBkColor() works on Windows 7 x64 with Aero.

But it works only with visible GUI.

If the user needs to use it in his script or has another UDF that uses WM_PAINT then hes screwed. Id rather set up a function that they can call to register it if they dont need it, and also give them instructions on how to pass the msg if they do need to use it.

I think providing the remark in UDF header is more than enough. User should use the UDF simple as possible.

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

But it works only with visible GUI.

Ah, indeed it does! Sorry :huh2:

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

I think providing the remark in UDF header is more than enough. User should use the UDF simple as possible.

U mean dont create function and add a remark saying they cant use wm_paint if using this udf? or remove extra remarks describing how to pass msgs?

Link to comment
Share on other sites

U mean dont create function and add a remark saying they cant use wm_paint if using this udf? or remove extra remarks describing how to pass msgs?

I mean just add this to the header (under #Region Header and Global Vars):

#cs
    Name:               GUIFFLabel UDF.
    Description:        "Flicker Free" label, a label that wont flicker, created using GDI+.
    Author:             
    AutoIt version:     3.3.6.1
    
    Remarks:            If $WM_PAINT OR $WM_NCPAINT are needed in your script you MUST pass the msgs to __GUICtrlFFLabel_WM_PAINT.
                        
                        Example:
                                
                                GUIRegisterMsg($WM_PAINT, "_Your_WM_PAINT")
                                GUIRegisterMsg($WM_PAINT, "_Your_WM_NCPAINT")
                                
                                Func _Your_WM_PAINT($hWndGUI, $MsgID, $wParam, $lParam)
                                    __GUICtrlFFLabel_WM_PAINT()
                                    ;your code...
                                EndFunc
                                
                                Func _Your_WM_NCPAINT($hWndGUI, $MsgID, $wParam, $lParam)
                                    __GUICtrlFFLabel_WM_PAINT()
                                    ;your code...
                                EndFunc
    
    History:
    
#CE

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

I mean just add this to the header (under #Region Header and Global Vars):

Ok so make function but move extra comments to the header. that sound good.

Since we are using wm_paint msgs I dont know if I can see a reason for having refresh and autorefresh. I cant see the user ever actually wanting his labels to disapper after restore..

Link to comment
Share on other sites

Ok so make function

I am not sure the use of it, what for?

Since we are using wm_paint msgs I dont know if I can see a reason for having refresh and autorefresh. I cant see the user ever actually wanting his labels to disapper after restore..

But when the labels are updated frequently in a loop, it is better to disable the autorefresh process, because it's done by the SetData function.

And no, the manual refresh function does not needed.

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

I am not sure the use of it, what for?

I see what your saying about keeping it simple. 90% of the time people wont need the to register the message themself, but for that 10% I like to leave some options other than going in and modifying the udf. I think for a middle ground I will add a _DisableRegisteringMsgs() function. This way the UDF will automatically register the msgs on the first label creation like you had it unless the disable function has been called.

But when the labels are updated frequently in a loop, it is better to disable the autorefresh process, because it's done by the SetData function.

And no, the manual refresh function does not needed.

At fist I didnt know what you ment here. But then it all hit me. Using WM_PAINT will be redrawing all our labels anytime any of autoits controls get repainted. Thats a problem to me. Plus for the user were removing the refresh function required at window restore, but adding a autorefreshmode that they have to turn on and off. Since we only have to refresh the labels after guisetstate(@SW_SHOW) and when restoring, we should be looking for only those msgs. WM_SIZE sends the window restore msg and WM_SHOWWINDOW for the other. This worked well for me unless theres something else im not thinking about again..

GUIRegisterMsg(0x0018, "__GUICtrlFFLabel_WM_SHOWWINDOW")
GUIRegisterMsg(0x0005, '__GUICtrlFFLabel_WM_SIZE')

Func __GUICtrlFFLabel_WM_SHOWWINDOW($hWndGUI, $MsgID, $wParam, $lParam)
    ConsoleWrite('@@ (263) :(' & @MIN & ':' & @SEC & ') __GUICtrlFFLabel_WM_SHOWWINDOW()' & @CR) ;### Function Trace

    _GUICtrlFFLabel_Refresh()
    Return 'GUI_RUNDEFMSG'

EndFunc

Func __GUICtrlFFLabel_WM_SIZE($hWndGUI, $MsgID, $wParam, $lParam)
    ConsoleWrite('@@ (272) :(' & @MIN & ':' & @SEC & ') __GUICtrlFFLabel_WM_SIZE()' & @CR) ;### Function Trace

    If $wParam = 0 Then _GUICtrlFFLabel_Refresh();window restored
    Return 'GUI_RUNDEFMSG'

EndFunc

Edit: Ok so those functions are not working well. The WM_PAINT msg still was, but not them. Both of them see the msg at the right time but writes to it just be for the window is activated. So now I tried WM_ACTIVATE msg. This one did work for the restoring. Sure this time. But not for the first GUISetState() call. Im not to woried about that though. Telling the user that they can either do a refresh after guisetstate(), or set the state before they create the labels is simple for use.

GUIRegisterMsg(0x0006, '_GUICtrlFFLabel_WM_ACTIVATE')


Func _GUICtrlFFLabel_WM_ACTIVATE ($hWndGUI, $MsgID, $wParam, $lParam)
    ConsoleWrite('activate = ' & _WinAPI_LoWord($wParam) & @CRLF)
    $iFlag = _WinAPI_LoWord($wParam)
    if $iFlag = 1 then _GUICtrlFFLabel_Refresh();window restored
EndFunc
Edited by Beege
Link to comment
Share on other sites

Ok so it was bugging me that I couldnt get WM_SHOWWINDOW and WM_SIZE to do what I want. So I went back and tried using these and seems to be very consistant.

Func __GUICtrlFFLabel_WM_SHOWWINDOW($hWndGUI, $MsgID, $wParam, $lParam)
    AdlibRegister('__GUICtrlFFLabel_RefreshAdLib', 100)
    Return 'GUI_RUNDEFMSG'
EndFunc   ;==>__GUICtrlFFLabel_WM_SHOWWINDOW

Func __GUICtrlFFLabel_WM_SIZE($hWndGUI, $MsgID, $wParam, $lParam)
    If $wParam = 0 Then AdlibRegister('__GUICtrlFFLabel_RefreshAdLib', 100)
    Return 'GUI_RUNDEFMSG'
EndFunc   ;==>__GUICtrlFFLabel_WM_SIZE

Func __GUICtrlFFLabel_RefreshAdLib()
    _GUICtrlFFLabel_Refresh();window restored
    AdlibUnRegister('__GUICtrlFFLabel_RefreshAdLib')
EndFunc
Link to comment
Share on other sites

Using WM_PAINT will be redrawing all our labels anytime any of autoits controls get repainted. Thats a problem to me.

Why it's a problem?

It's the most correct solution, WM_PAINT is there just for this purpose :huh2:

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

So I went back and tried using these and seems to be very consistant.

What will happen if you move the window outside the screen and back? ;)

I mean without the SetData in the loop, just drop/comment it for the sake of test :huh2:

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

What will happen if you move the window outside the screen and back? ;)

I mean without the SetData in the loop, just drop/comment it for the sake of test :huh2:

Lol not removing SetData in the loop has been then number one reason for me thinking something is working when it is indeed not Posted Image. Your right (AGAIN!) about moving the window off screen. I thought about that potential problem but when I tested it, I only moved a window over our window. I didnt actually move our window off screen. So ok will go back to using wm_paint with auto refresh function but i'm going to put a very extensive remark about the purpose of autorefresh function because at first I didnt even understand its purpose. Weather autorefresh its on or off, the user cant see the difference...but in actuallity there is a big difference to how many extra writes these labels will get if autorefresh is not off and the user has alot of other controls getting repainted.

Can you try compiling the example? The damn background color function is giving me problems again. but only when compiledPosted Image

Link to comment
Share on other sites

Can you try compiling the example?

Here is the compiled version, no problems on my side.

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

Here is the compiled version, no problems on my side.

No Im sorry, can you try it without using _GUICtrlFFLabel_GUISetBkColor(). Also can you try these examples below. Repaint on restore is not working for me, and for some reason when _GUICtrlFFLabel_GUISetBkColor() is used the repaint on startup isn't applied.

#include "GUIFFLabel.au3"

_Example1()
_Example2()

Func _Example1()
    Local $hGUI, $Label1, $Label2, $Label3, $iCount

    $hGUI = GUICreate("Flicker Free Labels", 400, 220)

    $Label1 = _GUICtrlFFLabel_Create($hGUI, "Label One", 80, 40, 240, 17)
    $Label2 = _GUICtrlFFLabel_Create($hGUI, "Label Two", 80, 80, 240, 17, 9, 'Times', 1, 0, 0xFF0000)
    $Label3 = _GUICtrlFFLabel_Create($hGUI, "Label Three", 80, 120, 240, 17)
    $nDel_Button = GUICtrlCreateButton("Delete (2)", 150, 180, 110, 20)
    GUISetState(@SW_SHOW)

;~  _GUICtrlFFLabel_GUISetBkColor($hGUI, 0xC0C0C0)

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                GUIDelete($hGUI)
                Return
            Case $nDel_Button
                _GUICtrlFFLabel_Delete($Label2)
        EndSwitch
    WEnd
EndFunc

Func _Example2()
    Local $hGUI, $Label1, $Label2, $Label3, $iCount

    $hGUI = GUICreate("Flicker Free Labels", 400, 220)

    $Label1 = _GUICtrlFFLabel_Create($hGUI, "Label One", 80, 40, 240, 17)
    $Label2 = _GUICtrlFFLabel_Create($hGUI, "Label Two", 80, 80, 240, 17, 9, 'Times', 1, 0, 0xFF0000)
    $Label3 = _GUICtrlFFLabel_Create($hGUI, "Label Three", 80, 120, 240, 17)
    $nDel_Button = GUICtrlCreateButton("Delete (2)", 150, 180, 110, 20)
    GUISetState(@SW_SHOW)

    _GUICtrlFFLabel_GUISetBkColor($hGUI, 0xC0C0C0)

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                GUIDelete($hGUI)
                Return
            Case $nDel_Button
                _GUICtrlFFLabel_Delete($Label2)
        EndSwitch
    WEnd
EndFunc
Link to comment
Share on other sites

can you try it without using _GUICtrlFFLabel_GUISetBkColor().

No problem here.

Also can you try these examples below. Repaint on restore is not working for me, and for some reason when _GUICtrlFFLabel_GUISetBkColor() is used the repaint on startup isn't applied.

Yes, we can fix it by refresh all labels inside the SetBkColor function:

Func _GUICtrlFFLabel_GUISetBkColor($hWnd, $nBkColor)
    GUISetBkColor($nBkColor, $hWnd)
    $nDef_GUI_Bk_Color = __GUICtrlFFLabel_GetWindowBkColor($hWnd)
    
    For $i = 1 To $g_aGDILbs[0][0]
        _GUICtrlFFLabel_Refresh($i)
    Next
EndFunc

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

No problem here.

Yes, we can fix it by refresh all labels inside the SetBkColor function:

Func _GUICtrlFFLabel_GUISetBkColor($hWnd, $nBkColor)
    GUISetBkColor($nBkColor, $hWnd)
    $nDef_GUI_Bk_Color = __GUICtrlFFLabel_GetWindowBkColor($hWnd)
    
    For $i = 1 To $g_aGDILbs[0][0]
        _GUICtrlFFLabel_Refresh($i)
    Next
EndFunc

Yup already got it. Posted ImageThats weird how it does it on mine but only when compiled. I wonder if its a window 7 thing.. Did you check the minimize/restore in those examples? Its doing the same thing to me as when I was using WM_SIZE. Its sending the refresh just before the window is visible and not getting appliedPosted Image Edited by Beege
Link to comment
Share on other sites

Did you check the minimize/restore in those examples?

Yes, no problem either.

I wonder if its a window 7 thing

Yes, just tested, from SciTE all ok, but when i run it as a script from desktop, the color is wrong.

Later i will test it more on Win7...

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

Later i will test it more on Win7...

Ok, try this out:

Func __GUICtrlFFLabel_GetWindowBkColor($hWnd = 0)
    Local $iState, $hDC, $iOpt, $hBkGUI, $nColor
    
    If $hWnd Then
        $hDC = _WinAPI_GetDC($hWnd)
        
        $iOpt = Opt("WinWaitDelay", 0)
        $iState = WinGetState($hWnd)
        
        If Not BitAND($iState, 2) Then WinSetState($hWnd, "", @SW_SHOWNOACTIVATE)
        $nColor = DllCall('gdi32.dll', 'int', 'GetBkColor', 'hwnd', $hDC)
        If Not BitAND($iState, 2) Then WinSetState($hWnd, "", @SW_HIDE)
        
        Opt("WinWaitDelay", $iOpt)
        
        $nColor = $nColor[0] ;BGR
        $nColor = Hex(BitOR(BitAND($nColor, 0x00FF00), BitShift(BitAND($nColor, 0x0000FF), -16), BitShift(BitAND($nColor, 0xFF0000), 16)), 6) ;convert to RGB
        
        _WinAPI_ReleaseDC($hWnd, $hDC)
        
        Return "0x" & $nColor
    EndIf
    
    $iOpt = Opt("PixelCoordMode", 2)
    $hBkGUI = GUICreate("", 2, 2, 0, 0, $WS_POPUP)
    GUISetState(@SW_SHOWNOACTIVATE, $hBkGUI)
    $nColor = "0x" & Hex(PixelGetColor(1, 1, $hBkGUI), 6)
    GUIDelete($hBkGUI)
    Opt("PixelCoordMode", $iOpt)
    
    Return $nColor
EndFunc

I think we have no choice than make the GUI visible, as you suggested in the first place. But i think i did it less noticeable this time :huh2:

Edited by MrCreatoR

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

I think we have no choice than make the GUI visible, as you suggested in the first place. But i think i did it less noticeable this time :huh2:

Ya thats pretty much what I ended up going with. Posted Image

Be sure to get the lastest one I posted. I made a lot additions and changes. I also changed most of my variable names to be prefixed with $g_FF_(annoying but needed). I had many that were way to common and easily cause conflicts. I did a lot of reading on msdn to learn more about when windows get repainted and found this which helped me a ton:

"An application draws in a window at a variety of times: when first creating a window, when changing the size of the window, when moving the window from behind another window, when minimizing or maximizing the window, when displaying data from an opened file, and when scrolling, changing, or selecting a portion of the displayed data."

Knowing this helped me pinpoint what msgs I can use (other than WM_PAINT) so that I don't have to have the disable refreshing labels, but at the same time not be doing extra unneeded writes to the labels. A problem I couldn't get around using paint was how to refresh a static label that's not in the loop if auto refresh is turned off. I came up with some solutions that I think are pretty solid cause I did a lot of testing and really couldn't find any conflicts. Only potential one I came up with was if they are using scroll bars on there gui so I just made a note telling them about it.

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