BkgndColor of disabled ListIcon

Everything else that doesn't fall into one of the other PB categories.
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

srod wrote:Well yes if you skin a control then you cannot rely on any color value. By default Windows will use the #COLOR_3DFACE (#COLOR_BTNFACE) for these things.
I'm not "skinning controls", I just activate the official "Classic Layout",
just because my XP does not need to look like a gay lavatory attendant.

I would bet over 67% of the Users do not use the ugly default skin, so what is that information worth anyways...
oh... and have a nice day.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Not really sure what you're on about Kaeru; when I activate the 'classic windows layout' then GetSysColor_() still gives me the correct value for a disabled list icon!

I can imagine some 'badly behaved' themes may deviate from this; though I haven't encountered one as yet!

When a ListIcon is first created then it is given the #COLOR_WINDOW back color. When it is disabled it is given #COLOR_3DFACE. These system colors are of course usually altered by any new theme, but the link will usually remain between #COLOR_WINDOW and #COLOR_3DFACE and enabled/disabled ListIcons. Course it is easy for a developer to over-ride all of this through owner-drawing etc.

The following code shows these defaults to be correct and works here if I switch to a classic theme on Vista or not.

Code: Select all

OpenWindow(0,0,0,320,240,"",#PB_Window_SystemMenu|#PB_Window_ScreenCentered) 
ListIconGadget(0,0,0,200,200,"Column 0",200) 

InvalidateRect_(GadgetID(0), 0, 1)
UpdateWindow_(GadgetID(0))
hdc = GetDC_(GadgetID(0)) 
color = GetPixel_(hdc, 2,30) 
ReleaseDC_(GadgetID(0), hdc) 

Debug "Enabled ListIcon"
Debug "    Color from pixel (2, 30) = " + Str(color)
Debug "    Color from GetSysColor_(#COLOR_WINDOW) = " + Str(GetSysColor_(#COLOR_WINDOW))
Debug "======"

DisableGadget(0,1) 

InvalidateRect_(GadgetID(0), 0, 1)
UpdateWindow_(GadgetID(0))
hdc = GetDC_(GadgetID(0)) 
color = GetPixel_(hdc, 2,30) 
ReleaseDC_(GadgetID(0), hdc) 

Debug "Disabled ListIcon"
Debug "    Color from pixel (2, 30) = " + Str(color)
Debug "    Color from GetSysColor_(#COLOR_3DFACE) = " + Str(GetSysColor_(#COLOR_3DFACE))

quit=0 
Repeat 
   Select WaitWindowEvent() 
     Case #PB_Event_CloseWindow 
        quit=1 
   EndSelect 
Until quit 
Too much of a coinicidence I think.
I may look like a mule, but I'm not a complete ass.
Denis
Enthusiast
Enthusiast
Posts: 790
Joined: Fri Apr 25, 2003 5:10 pm
Location: Doubs - France

Post by Denis »

srod wrote:Denis, if you haven't applied any skinning then GetSysColor_() should give you the correct result and saves you having to retrieve a pixel etc.
Under Win2000 Pro + Pack 4 both colors are the same.

I will try this afternoon under XP/Vista.

Tks srod (not enough explanations from MS SDK).
A+
Denis
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

srod wrote:Not really sure what you're on about Kaeru; when I activate the 'classic windows layout' then GetSysColor_() still gives me the correct value for a disabled list icon!
I'm sorry, srod!
I mixed something up.

it wasn't directly a problem with BTNFACE / 3DFace,
but a problem to access this color via the standard color-schemer.

just forget my postings here.
oh... and have a nice day.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

What postings?

:wink:
I may look like a mule, but I'm not a complete ass.
Post Reply