Modify

#505 closed Bug (Works For Me)

_GUICtrlStatusBar_SetBkColor doesn't work

Reported by: gcriaco <gcriaco@…> Owned by:
Milestone: Component: AutoIt
Version: 3.2.13.7 Severity: None
Keywords: Cc:

Description

The function returns the background color, but the statusbar color doesn't change.

Example:

; Set background color
msgbox(0,"Test", _GUICtrlStatusBar_SetBkColor ($hStatus, $CLR_RED))

Attachments (1)

Example.zip (65.1 KB ) - added by gcriaco <gcriaco@…> on Aug 8, 2008 at 1:07:35 PM.

Download all attachments as: .zip

Change History (8)

comment:1 by TicketCleanup, on Aug 8, 2008 at 10:00:14 AM

Milestone: 3.2.13.8

Automatic ticket cleanup.

comment:2 by Gary, on Aug 8, 2008 at 10:08:53 AM

Resolution: Works For Me
Status: newclosed

by gcriaco <gcriaco@…>, on Aug 8, 2008 at 1:07:35 PM

Attachment: Example.zip added

in reply to:  description comment:3 by gcriaco <gcriaco@…>, on Aug 8, 2008 at 1:10:24 PM

Replying to gcriaco <gcriaco@gmail.com>:

The function returns the background color, but the statusbar color doesn't change.

Example:

; Set background color
msgbox(0,"Test", _GUICtrlStatusBar_SetBkColor ($hStatus, $CLR_RED))

Here's the complete code:
#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WinAPI.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_SB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hGUI, $hStatus
Local $aParts[3] = [75, 150, -1]


; Create GUI
$hGUI = GUICreate("(Example 1) StatusBar Set BkColor", 400, 300)
$hStatus = _GUICtrlStatusBar_Create ($hGUI)
GUISetState()

; Set parts
_GUICtrlStatusBar_SetParts ($hStatus, $aParts)
_GUICtrlStatusBar_SetText ($hStatus, "Part 1")
_GUICtrlStatusBar_SetText ($hStatus, "Part 2", 1)

; Set background color
msgbox(0,"Test", _GUICtrlStatusBar_SetBkColor ($hStatus, $CLR_RED))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()

EndFunc ;==>_Main

The same thing happens on both beta (latest) and prod autoit version.
My p.c. is a WinXP SP3 machine
the attachement shows my gui.

comment:4 by Gary, on Aug 8, 2008 at 5:20:59 PM

Either turn off themes on system or in the script

for example:

#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WinAPI.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_SB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

    Local $hGUI, $hStatus
    Local $aParts[3] = [75, 150, -1]

	_XPThemeLevel(1)
    ; Create GUI
    $hGUI = GUICreate("(Example 1) StatusBar Set BkColor", 400, 300)
    $hStatus = _GUICtrlStatusBar_Create ($hGUI)
    GUISetState()

    ; Set parts
    _GUICtrlStatusBar_SetParts ($hStatus, $aParts)
    _GUICtrlStatusBar_SetText ($hStatus, "Part 1")
    _GUICtrlStatusBar_SetText ($hStatus, "Part 2", 1)

    ; Set background color
    msgbox(0,"Test", _GUICtrlStatusBar_SetBkColor ($hStatus, $CLR_RED))

    ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()

EndFunc ;==>_Main 

; Functionality :
; just info about possibility to turn off theme-using in scripts/compiled-exe with using GUI stuff
; This info was produced by Holger
Func _XPThemeLevel($nFlag = 0)
    ; $nFlag = 0  ; Visual styles are completely disabled in the running script
    ; $nFlag = 1; Nonclient areas of the GUI can use visual styles
    ; $nFlag = 2; Controls can use visual styles (like Buttons, Progressbar, Group-ctrl's, etc.)
    ; $nFlag = 4; Web content displayed ??? (info from MSDN) can use visual styles
    ;
    ; These flags can be combined with BitOr(...)

    DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", $nFlag)
EndFunc   ;==>_XPThemeLevel

in reply to:  description comment:5 by anonymous, on Aug 11, 2008 at 7:51:31 AM

Replying to gcriaco <gcriaco@gmail.com>:

The function returns the background color, but the statusbar color doesn't change.

Example:

; Set background color
msgbox(0,"Test", _GUICtrlStatusBar_SetBkColor ($hStatus, $CLR_RED))

You're right as alweays.

Many thanks
Peppe

comment:6 by partypooper@…, on Jul 31, 2009 at 2:18:06 AM

Can we have a footnote in the Helpfile about turning off XP themes in order to get this to work as I was about to open another ticket until I did saw this.

BTW, what about Vista/2000/Win7 etc., - are they effected as well?

comment:7 by anonymous, on Jun 14, 2011 at 7:40:59 AM

Two years later and the damn thing caught me out again, this time using Windows 7 instead of WinXP. Still believe a note in the help file would be of benefit.

Modify Ticket

Action
as closed The ticket will remain with no owner.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.