Page 2 of 2
Posted: Mon May 25, 2009 6:57 pm
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...
Posted: Mon May 25, 2009 9:06 pm
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.
Posted: Tue May 26, 2009 10:35 am
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).
Posted: Tue May 26, 2009 1:22 pm
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.
Posted: Tue May 26, 2009 1:24 pm
by srod
What postings?
