Jump to content

Flicker Free Labels


Beege
 Share

Recommended Posts

Be sure to get the lastest one I posted. I made a lot additions and changes.

Few points if i may...

* Why don't you let users pass rgb colors instead of argb?

* _GUICtrlFFLabel_SetTextColor doesn't work for me.

* I don't think you should use all these messages, they are much usable by other UDFs and this will cause conflicts.

* FFLabels name sound like it's somehow related to FireFox (there is FF UDF out there) :)

* And i would name variables like this: $h_GFFL_GUI, $a_GFFL_GDILbls, etc.

* I don't see any notes about WM_* messages usage...

 

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

And one more thing:

* You have an issue with GUI styles, you should add (BitOr) styles to $GUI_SS_DEFAULT_GUI, because it's causing labels to dissapear if nothing is updated after GUISetState(@SW_SHOW).

 

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

It's a shame we can't set resizing mode to the label :)

 

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

* Why don't you let users pass rgb colors instead of argb?

I didnt see how it could hurt not letting the user send argb. I should be able to let the user send either. I will play around with it.

* _GUICtrlFFLabel_SetTextColor doesn't work for me.

I know i realized soon after I posted that I forgot to add a refresh after color change. It should be working, just not showing up until next call to SetData. Ill fix that.

* I don't think you should use all these messages, they are much usable by other UDFs and this will cause conflicts.

Thats why I made the _GUICtrlFFLabel_DisableMsgRegister() function. If the user needs these msgs in another UDF or in there script all they have to do is call this function and pass the msgs along. If this is done no conflicts should happen. I really cant justify not using a msg in a UDF only because another UDF wants to use it. Everyone has to share

* FFLabels name sound like it's somehow related to FireFox (there is FF UDF out there) :)

Link to comment
Share on other sites

Thats why I made the _GUICtrlFFLabel_DisableMsgRegister() function. If the user needs these msgs in another UDF or in there script all they have to do is call this function and pass the msgs along.

But then labels wont be refreshed, or i am wrong?

I try to stay consistant with the way I name my variables in a lot of my code. Prefixing any global with $g_ is just the way I do it. If I change that Ill be hitting backspace a lot more.

There is Search & Replace option in SciTE (Ctrl + H), use Regular Expression checkbox and it's mater of few seconds to replace these vars.

 

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 then labels wont be refreshed, or i am wrong?

Only if the user forgets to foward the msgs. Here the example I will put in to show how to set up if they need to use any of these msgs:

#include "FFLabels.au3"

Global $hGUI = GUICreate("Flicker Free Labels", 409, 218, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_SIZEBOX))

_GUICtrlFFLabel_DisableMsgRegister()
Global $Label = _GUICtrlFFLabel_Create($hGUI, "Label Two    = " & Random(1, 100000), 80, 80, 240, 17)

GUIRegisterMsg(0x0214, 'WM_SIZING');
GUIRegisterMsg($WM_SIZE, 'WM_SIZE')
GUIRegisterMsg(0x0232, 'WM_EXITSIZEMOVE')
GUIRegisterMsg(0x0231, 'WM_ENTERSIZEMOVE')

GUISetState(@SW_SHOW)

While 1
    Switch GUIGetMsg()
        Case -3;$GUI_EVENT_CLOSE
            Exit
        Case Else
;~              _GUICtrlFFLabel_SetData($Label, "Label Two  = " & Random(1, 100000))
    EndSwitch
WEnd

Func WM_SIZE($hWndGUI, $MsgID, $WParam, $LParam)
    __GUICtrlFFLabel_WM_SIZE($hWndGUI, $MsgID, $WParam)
    ;USER CODE;
EndFunc   ;==>WM_SIZE

Func WM_SIZING($hWndGUI, $MsgID, $WParam, $LParam)
    __GUICtrlFFLabel_WM_SIZING()
    ;USER CODE;
EndFunc   ;==>WM_SIZING

Func WM_ENTERSIZEMOVE($hWndGUI, $MsgID, $WParam, $LParam)
    __GUICtrlFFLabel_WM_ENTERSIZEMOVE($hWndGUI)
    ;USER CODE;
EndFunc   ;==>WM_ENTERSIZEMOVE

Func WM_EXITSIZEMOVE($hWndGUI, $MsgID, $WParam, $LParam)
    __GUICtrlFFLabel_WM_EXITSIZEMOVE()
    ;USER CODE;
EndFunc   ;==>WM_EXITSIZEMOVE

There is Search & Replace option in SciTE (Ctrl + H), use Regular Expression checkbox and it's mater of few seconds to replace these vars.

No no.. I mean the way I think and automatically start typing $g_ when Im accesing a global variable.. Your thinking they are still too common? cause thats really all I was trying to avoid... Edited by Beege
Link to comment
Share on other sites

And one more thing:

* You have an issue with GUI styles, you should add (BitOr) styles to $GUI_SS_DEFAULT_GUI, because it's causing labels to dissapear if nothing is updated after GUISetState(@SW_SHOW).

Im not sure I understand. Can you show me the example you tried? this is how I tested:

Func _ExampleS()

    Local $hGUI = GUICreate("Flicker Free Labels", 409, 218, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_SIZEBOX))
    Local $Label = _GUICtrlFFLabel_Create($hGUI, "Flicker Free", 140, 80, 129, 33, 16)
    GUISetState(@SW_SHOW)

    While 1
        Switch GUIGetMsg()
            Case -3;$GUI_EVENT_CLOSE
                GUIDelete($hGUI)
                Return
        EndSwitch
    WEnd

EndFunc   ;==>_FlickerFreeExample1

It's a shame we can't set resizing mode to the label :)

I know! Ive been thinking about what would go into it...Posted Image
Link to comment
Share on other sites

Here the example I will put in to show how to set up if they need to use any of these msgs:

I don't see the point of disabling msgs since the GUIRegisterMsg anyway will register message to new function ;)

Your thinking they are still too common? cause thats really all I was trying to avoid...

$g_ it's ok (it's even mentioned in the help file, so ho am i to tell that this is wrong), but at least use it like this: $g_GFFL_i...

Can you show me the example you tried?

Sorry, it's probably was caused by some tweak i made to the UDF, with your original script all fine.

P.S

Someone (well, you probably know him, it's Yashied ;)) told me that all this concept may be usless if there is no real usage example. What he meant is that we can update the standard label without flickering if we seperate the static part of the label from the dynamic one, like this:

#include <GUIConstantsEx.au3>

$hGUI = GUICreate("Test Script", 300, 200)

$nStatic_Label = GUICtrlCreateLabel("Data:", 20, 40, -1, 20)
$nDynamic_Label = GUICtrlCreateLabel("", 60, 40, 260, 20)

GUISetState(@SW_SHOW, $hGUI)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case Else
            GUICtrlSetData($nDynamic_Label, Random(1, 1000))
    EndSwitch
WEnd

So what you should do is to provide an example that will show that there is cases when this trick wont work, and we will have to use your UDF.

:)

 

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 don't see the point of disabling msgs since the GUIRegisterMsg anyway will register message to new function ;)

$g_ it's ok (it's even mentioned in the help file, so ho am i to tell that this is wrong), but at least use it like this: $g_GFFL_i...

Sorry, it's probably was caused by some tweak i made to the UDF, with your original script all fine.

P.S

Someone (well, you probably know him, it's Yashied ;)) told me that all this concept may be usless if there is no real usage example. What he meant is that we can update the standard label without flickering if we seperate the static part of the label from the dynamic one, like this:

#include <GUIConstantsEx.au3>

$hGUI = GUICreate("Test Script", 300, 200)

$nStatic_Label = GUICtrlCreateLabel("Data:", 20, 40, -1, 20)
$nDynamic_Label = GUICtrlCreateLabel("", 60, 40, 260, 20)

GUISetState(@SW_SHOW, $hGUI)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case Else
            GUICtrlSetData($nDynamic_Label, Random(1, 1000))
    EndSwitch
WEnd

So what you should do is to provide an example that will show that there is cases when this trick wont work, and we will have to use your UDF.

:)

You are so right about the disable msg function! That will not be needed at all! (its not needed in my other udfs either Posted Image) I always thought the user would need to unregister mine with a blank string and then re-register his.

Ya I can defiantly change the example a little to show even if they were broken up with static sections and smaller labels, they would still flicker. I admit I made them long like that to emphasize the flicker...but I used the same long label when showing no flicker...Posted Image

Link to comment
Share on other sites

New update up. Also If anyone knows anything about setting character width in GDI+ I would be most greatful! Little problem that ended up being much much harder than I ever thought it would be to fix. Posted Image

Link to comment
Share on other sites

  • 2 years later...
Link to comment
Share on other sites

  • 4 months later...

I was sooo.... hoping to find $GUI_BKCOLOR_TRANSPARENT by the end of the thread :)

So I tried  this in my app where I saw a litle flickering and did not need transparency, indeed it adresses the flickering BUT.

It does not refresh when the GUI is hidden by another window, then revealed by that window moving off.

How do I know when to redraw?

Edited by LeCarre
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...