Jump to content

Flicker Free Labels


Beege
 Share

Recommended Posts

Ahh yes pixelcoordmode... makes sense now. Worked like a charm. I will make another update with the delete func and name changes. thanks Posted Image

Link to comment
Share on other sites

Wait..Not just yet. Something with my example or the delete is wrong. this is crashing:

Func _FlickerFreeExample()

    Local $Form1 = GUICreate("Flicker Free Labels", 409, 218, 401, 266)

    Local $Label1 = _GUICtrlFFLabel_Create($Form1, "test", 80, 40, 240, 17)
    Local $Label2 = _GUICtrlFFLabel_Create($Form1, "", 80, 80, 240, 17, 9)
    Local $Label3 = _GUICtrlFFLabel_Create($Form1, "", 80, 120, 240, 17, 9)
    Local $Button1 = GUICtrlCreateButton("Delete", 148, 164, 113, 21, $WS_GROUP)

    GUISetState(@SW_SHOW)
    _GUICtrlFFLabel_Refresh()

    Local $iCount, $bRemoved = False
    While 1
        Switch GUIGetMsg()
            Case -3;$GUI_EVENT_CLOSE
                GUIDelete($Form1)
                Return
            Case -5;$GUI_EVENT_RESTORE
                _GUICtrlFFLabel_Refresh()
            Case $Button1
                _GUICtrlFFLabel_Delete($Label1)
                $bRemoved = True
            Case Else

                $iCount = Random(1, 100000)

                If Not $bRemoved Then
                    _GUICtrlFFLabel_SetData($Label1, "Label One     = " & $iCount)
                EndIf

                $iCount = Random(1, 100000)
                _GUICtrlFFLabel_SetData($Label2, "Label Two     = " & $iCount)
                $iCount = Random(1, 100000)
                _GUICtrlFFLabel_SetData($Label3, "Label Three  = " & $iCount)
        EndSwitch
    WEnd
EndFunc   ;==>_FlickerFreeExample
Link to comment
Share on other sites

Got it worked out. Resizing the array during the delete will make all the other labels previously assigned index values wrong. Leaving the array alone and just adding a mod to the dispose function to not dispose deleted ctrls will work.

Func _GUICtrlFFLabel_Delete($iIndex)
    If $iIndex > $g_aGDILbs[0][0] Then Return SetError(-1)

    $g_aGDILbs[$iIndex][$g_sRestore] = ""
    __GUICtrlFFLabel_WriteBuffer($iIndex)
    _GUICtrlFFLabel_SetData($iIndex, $g_aGDILbs[$iIndex][$g_sRestore])

    _GDIPlus_FontDispose($g_aGDILbs[$iIndex][$g_hFont])
    _GDIPlus_StringFormatDispose($g_aGDILbs[$iIndex][$g_hStringformat])
    _GDIPlus_FontFamilyDispose($g_aGDILbs[$iIndex][$g_FontFamily])
    _GDIPlus_BrushDispose($g_aGDILbs[$iIndex][$g_hBrush])
    _GDIPlus_GraphicsDispose($g_aGDILbs[$iIndex][$g_hBuffer])
    _GDIPlus_ImageDispose($g_aGDILbs[$iIndex][$g_hBitmap])

    $g_aGDILbs[$iIndex][$g_bRemoved] = True
EndFunc


Func __GUICtrlFFLabel_Dispose()
    For $i = 1 To $g_aGDILbs[0][0] - 1
        If Not $g_aGDILbs[$i][$g_bRemoved] Then
            _GDIPlus_FontDispose($g_aGDILbs[$i][$g_hFont])
            _GDIPlus_StringFormatDispose($g_aGDILbs[$i][$g_hStringformat])
            _GDIPlus_FontFamilyDispose($g_aGDILbs[$i][$g_FontFamily])
            _GDIPlus_BrushDispose($g_aGDILbs[$i][$g_hBrush])
            _GDIPlus_GraphicsDispose($g_aGDILbs[$i][$g_hBuffer])
            _GDIPlus_ImageDispose($g_aGDILbs[$i][$g_hBitmap])
        EndIf
    Next
    _GDIPlus_GraphicsDispose($g_hGraphics)
    _GDIPlus_Shutdown()
EndFunc   ;==>__GUICtrlFFLabel_Dispose
Edited by Beege
Link to comment
Share on other sites

Got it worked out. Resizing the array during the delete will make all the other labels previously assigned index values wrong.

Yes, i came up with the same conclusion :huh2:

But different solution:

Func _GUICtrlFFLabel_Delete($iIndex)
    If $iIndex > $g_aGDILbs[0][0] Then Return SetError(-1)
    
    _GUICtrlFFLabel_SetData($iIndex, "")
    
    _GDIPlus_FontDispose($g_aGDILbs[$iIndex][$g_hFont])
    _GDIPlus_StringFormatDispose($g_aGDILbs[$iIndex][$g_hStringformat])
    _GDIPlus_FontFamilyDispose($g_aGDILbs[$iIndex][$g_FontFamily])
    _GDIPlus_BrushDispose($g_aGDILbs[$iIndex][$g_hBrush])
    _GDIPlus_GraphicsDispose($g_aGDILbs[$iIndex][$g_hBuffer])
    _GDIPlus_ImageDispose($g_aGDILbs[$iIndex][$g_hBitmap])
    
    $g_aGDILbs[$iIndex][$g_iTop] = 0
    $g_aGDILbs[$iIndex][$g_iWidth] = 0
    $g_aGDILbs[$iIndex][$g_iHeight] = 0
    $g_aGDILbs[$iIndex][$g_hBitmap] = 0
    $g_aGDILbs[$iIndex][$g_hBuffer] = 0
    $g_aGDILbs[$iIndex][$g_hBrush] = 0
    $g_aGDILbs[$iIndex][$g_FontFamily] = 0
    $g_aGDILbs[$iIndex][$g_hStringformat] = 0
    $g_aGDILbs[$iIndex][$g_hFont] = 0
    $g_aGDILbs[$iIndex][$g_Layout] = 0
EndFunc

Func __GUICtrlFFLabel_Dispose()
    For $i = 1 To $g_aGDILbs[0][0]
        If $g_aGDILbs[$i][$g_hFont] Then
            _GDIPlus_FontDispose($g_aGDILbs[$i][$g_hFont])
            _GDIPlus_StringFormatDispose($g_aGDILbs[$i][$g_hStringformat])
            _GDIPlus_FontFamilyDispose($g_aGDILbs[$i][$g_FontFamily])
            _GDIPlus_BrushDispose($g_aGDILbs[$i][$g_hBrush])
            _GDIPlus_GraphicsDispose($g_aGDILbs[$i][$g_hBuffer])
            _GDIPlus_ImageDispose($g_aGDILbs[$i][$g_hBitmap])
        EndIf
    Next
    
    _GDIPlus_GraphicsDispose($g_hGraphics)
    _GDIPlus_Shutdown()
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

And one more issue with bk color.

Try to use white color:

_GUICtrlFFLabel_SetData($Label3, "Label Three  = " & $iCount, 0xFFFFFFFF)

the same as -1 :huh2:

so we should use 0 instead:

Func _GUICtrlFFLabel_SetData($iIndex, $sText, $iBackGround = 0)
    If $iIndex > $g_aGDILbs[0][0] Then Return SetError(-1)
    
    If $iBackGround = 0 Or $iBackGround = Default Then $iBackGround = $nDef_GUI_Bk_Color
    ...
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

oh good call. Cant use 0 either incase they want to use black. Maybe a random string is best?

edit - No wait just default will work. thats what it forPosted Image

Edited by Beege
Link to comment
Share on other sites

Cant use 0 either incase they want to use black

For the black it could be 0xFF000000 :huh2:

P.S

But we should let the users provide colors as rgb, then we solving this issue easily.

 

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 issue. If we not updating the data in loop, the labels are dissapears after we move the window out of the screen.

I have added internal autorefresh function by AdlibRegister, and user function to disable the auto-refresh process, to avoid flickering when updating labels data in the loop :huh2:

- Also now _GUICtrlFFLabel_Refresh used for one label and recieves $iIndex parameter.

- Fixed all above issues (i think).

GUIFFLabel.zip

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

Here a way to get the background color of the GUI:

#include <FFLabels.au3>

;~ _FlickerExample()
_FlickerFreeExample()

Func _FlickerFreeExample()

    Local $Form1 = GUICreate("Flicker Free Labels", 400, 220)
    GUISetBkColor(0xABCDEF, $Form1)
    Local $Label1 = _FF_GuiCtrlCreateLabel($Form1, "test", 80, 40, 240, 17)
    Local $Label2 = _FF_GUICtrlCreateLabel($Form1, "", 80, 80, 240, 17, 9)
    Local $Label3 = _FF_GUICtrlCreateLabel($Form1, "", 80, 120, 240, 17, 9)
    GUISetState(@SW_SHOW)

    Local $hDC = _WinAPI_GetDC($Form1)
    $bgc = DllCall('gdi32.dll', 'int', 'GetBkColor', 'hwnd', $hDC)
    $bgc = $bgc[0] ;BGR
    $bgc = Hex(BitOR(BitAND($bgc, 0x00FF00), BitShift(BitAND($bgc, 0x0000FF), -16), BitShift(BitAND($bgc, 0xFF0000), 16)), 6) ;convert to RGB
    _WinAPI_ReleaseDC($Form1, $hDC)

    _FF_Refresh()

    Local $iCount
    While 1
        Switch GUIGetMsg()
            Case -3;$GUI_EVENT_CLOSE
                GUIDelete($Form1)
                Return
            Case -5;$GUI_EVENT_RESTORE
                _FF_Refresh()
            Case Else
                $iCount = Random(1, 100000)
                _FF_GUICtrlSetData($Label1, "Label One  = " & $iCount, 0xFFFFFFFF)
                $iCount = Random(1, 100000)
                _FF_GUICtrlSetData($Label2, "Label Two  = " & $iCount, "0xFF" & $bgc)
                $iCount = Random(1, 100000)
                _FF_GUICtrlSetData($Label3, "Label Three  = " & $iCount)
        EndSwitch
    WEnd
EndFunc   ;==>_FlickerFreeExample

Func _FlickerExample()

    Local $Form1 = GUICreate("Flickering Labels", 400, 220)
    Local $Label1 = GUICtrlCreateLabel("", 80, 40, 240, 17)
    GUICtrlSetFont(-1, 9, 200, 0, 'Microsoft Sans Serif')
    Local $Label2 = GUICtrlCreateLabel("", 80, 80, 240, 17)
    GUICtrlSetFont(-1, 9, 200, 0, 'Microsoft Sans Serif')
    Local $Label3 = GUICtrlCreateLabel("", 80, 120, 240, 17)
    GUICtrlSetFont(-1, 9, 200, 0, 'Microsoft Sans Serif')
    GUISetState(@SW_SHOW)

    Local $iCount
    While 1
        Switch GUIGetMsg()
            Case -3; $GUI_EVENT_CLOSE
                GUIDelete($Form1)
                Return
            Case -5; $GUI_EVENT_RESTORE
                _FF_Refresh()
            Case Else
                $iCount = Random(1, 100000)
                GUICtrlSetData($Label1, "Label One  = " & $iCount)
                $iCount = Random(1, 100000)
                GUICtrlSetData($Label2, "Label Two  = " & $iCount)
                $iCount = Random(1, 100000)
                GUICtrlSetData($Label3, "Label Three  = " & $iCount)
        EndSwitch
    WEnd
EndFunc   ;==>_FlickerExample

Br,

UEZ

Edited 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

Here a way to get the background color of the GUI:

In this method the GUI must be visible, with PixelGetColor it's not requierd :huh2:

So we can get the color even before the main GUI is created.

 

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 also thought about PixelGetColor() but I digged into WinAPI functions to find a way. :huh2:

Many roads lead to Rome...

Br,

UEZ

Edited 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

In this method the GUI must be visible, with PixelGetColor it's not requierd :huh2:

So we can get the color even before the main GUI is created.

True...but with PixelGetColor were limited to only getting the default BG color. I like the idea of being able to set the color to whatever the user has already chosen as a BG Color..

Link to comment
Share on other sites

True...but with PixelGetColor were limited to only getting the default BG color. I like the idea of being able to set the color to whatever the user has already chosen as a BG Color..

There is no need to, if the user desided to set different gui bk color, so it's his responsibility to set the label bk color. Could be added as remark to the UDF header.

Anyway, we should find a way to make it really transparent, because even if we use GetBkColor method, the user can set bk color for the gui later, after we set the label bk color.

 

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

There is no need to, if the user desided to set different gui bk color, so it's his responsibility to set the label bk color. Could be added as remark to the UDF header.

Anyway, we should find a way to make it really transparent, because even if we use GetBkColor method, the user can set bk color for the gui later, after we set the label bk color.

Yes transparent would definatly be the best. Ive been looking through msdn on color.transparent property but still havent got it. GetBkColor still isnt working for me though so not changing what we got. I dont know why it always returns black for me.

I have some intermittent hickups again with the pixelgetcolor method we were working on last night. If I launch the eample by dbclicking in windows explorer (not being launched from Scite), sometimes it grabs the correct color sometimes it doesn't. A compiled version works every time thought. Posted Image

Link to comment
Share on other sites

Temporary solution:

Func _GUICtrlFFLabel_GUISetBkColor($hWnd, $nBkColor)
    GUISetBkColor($nBkColor, $hWnd)
    $nDef_GUI_Bk_Color = __GUICtrlFFLabel_GetWindowBkColor($hWnd)
EndFunc

Func __GUICtrlFFLabel_GetWindowBkColor($hWnd = 0)
    Local $hDC, $iOpt, $hBkGUI, $nColor
    
    If $hWnd Then
        $hDC = _WinAPI_GetDC($hWnd)
        $nColor = DllCall('gdi32.dll', 'int', 'GetBkColor', 'hwnd', $hDC)
        $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
    
    $hBkGUI = GUICreate("", 100, 100, -100, -100)
    $iOpt = Opt("PixelCoordMode", 1)
    $nColor = "0x" & Hex(PixelGetColor(50, 50, $hBkGUI), 6)
    Opt("PixelCoordMode", $iOpt)
    GUIDelete($hBkGUI)
    
    Return $nColor
EndFunc

the user will use _GUICtrlFFLabel_GUISetBkColor instead of built-in GUISetBkColor function, but only after the gui is shown (after GUISetState(@SW_SHOW) line).

 

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

How abot that instead of __GUICtrlFFLabel_RefreshAllProc:

Func __GUICtrlFFLabel_WM_PAINT()
    If Not $g_iRefreshAllProc Then Return $GUI_RUNDEFMSG
    
    For $i = 1 To $g_aGDILbs[0][0]
        _GUICtrlFFLabel_SetData($i, $g_aGDILbs[$i][$g_sRestore])
    Next
    
    Return $GUI_RUNDEFMSG
EndFunc

and register WM_PAINT:

If $g_aGDILbs[0][0] = 1 Then
        ;AdlibRegister("__GUICtrlFFLabel_RefreshAllProc", 10)
        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.
    EndIf

it solves some issues with erased labels.

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

How abot that instead of __GUICtrlFFLabel_RefreshAllProc:

Func __GUICtrlFFLabel_WM_PAINT()
    If Not $g_iRefreshAllProc Then Return $GUI_RUNDEFMSG
    
    For $i = 1 To $g_aGDILbs[0][0]
        _GUICtrlFFLabel_SetData($i, $g_aGDILbs[$i][$g_sRestore])
    Next
    
    Return $GUI_RUNDEFMSG
EndFunc

and register WM_PAINT:

If $g_aGDILbs[0][0] = 1 Then
        ;AdlibRegister("__GUICtrlFFLabel_RefreshAllProc", 10)
        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.
    EndIf

it solves some issues with erased labels.

I love the idea of the label refreshing themselves. I will definatly add that! But the dllcall GetBkColor just wont work... Even if i put a sleep(1000) after guisetstate() to make sure its visible. It always returns black. Posted Image

UEZ are you running win 7 or xp?

Edited by Beege
Link to comment
Share on other sites

MrCreatoR forget what I said about the bg function being intermittent. Its fine. I somehow had one of the old methods that didnt work in another one of my scripts. Posted Image

Link to comment
Share on other sites

Try the whole thing togheter.

GUIFFLabel.zip

 

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

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