Page 1 of 2
BkgndColor of disabled ListIcon
Posted: Mon May 25, 2009 4:14 am
by Denis
I'm looking for a way to get the background color of a listicongadget when it is disabled.
I didn't find a solution, i try with some API but without succes.
It is possible to have two ways, one with themes, the oder one without.
Tks
Posted: Mon May 25, 2009 4:24 am
by netmaestro
Code: Select all
color = SendMessage_(<listicon>,#LVM_GETBKCOLOR,0,0)
Should work whether disabled or not.
Posted: Mon May 25, 2009 4:53 am
by Denis
Hi netmaestro,
that's the first code i try but it returns the normal background color (under vista for my computer, white and the disabled color is a light gray).
Posted: Mon May 25, 2009 5:06 am
by netmaestro
Not so easy, eh? When the going gets tough, the tough... cheat!
Code: Select all
OpenWindow(0,0,0,320,240,"",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
ListIconGadget(0,0,0,200,200,"Column 0",200)
DisableGadget(0,1)
color = SendMessage_(gadgetid(0),#LVM_GETBKCOLOR,0,0):Debug color ; wrong
; Ok, another try:
hdc = GetDC_(gadgetid(0))
color = GetPixel_(hdc, 2,30)
ReleaseDC_(gadgetid(0), hdc)
Debug color ; looks right
quit=0
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
quit=1
EndSelect
Until quit
Posted: Mon May 25, 2009 6:02 am
by Denis
Hoouuuuu ! (it's so simple :roll: ) and it rocks
i spend many time on it...
Many tks netmaestro
Posted: Mon May 25, 2009 12:06 pm
by srod
Is it not just the #COLOR_BTNFACE system color which you can retrieve with GetSysColor_() ?
Posted: Mon May 25, 2009 12:54 pm
by Fluid Byte
srod wrote:Is it not just the #COLOR_BTNFACE system color which you can retrieve with GetSysColor_() ?
Yes, it is.

Posted: Mon May 25, 2009 2:45 pm
by netmaestro
Ok you guys, if you're going to start making sense I don't know what I'm going to do!

Posted: Mon May 25, 2009 3:39 pm
by srod
netmaestro wrote:Ok you guys, if you're going to start making sense I don't know what I'm going to do!

Don't worry, it was just a rare moment of lucidity fuelled by a lack of alcohol! It won't happen again!

Posted: Mon May 25, 2009 4:48 pm
by blueznl
We *almost* believe Srod, but as he is known to delve into the deep and dark recesses of the human mind (and appearently meets the likes of us down there

) we do put some question marks around his (or our

) soberness...
Well, at least it did not involve hamsters.
Posted: Mon May 25, 2009 4:50 pm
by Kaeru Gaman
srod wrote:Is it not just the #COLOR_BTNFACE system color which you can retrieve with GetSysColor_() ?
no. there was something lately in the german forums...
if I remember correctly, it strongly depends on the skinning.
if it's the same as ButtonFace, it's just a coincidence.
Posted: Mon May 25, 2009 6:02 pm
by Denis
I didn't get good result with Listicon inside a nxSplitter (from srod lib), i just get a color value of $FFFFFFFF. So i've created an hidden listicon outside nxSplitter and that's Ok.
Posted: Mon May 25, 2009 6:41 pm
by srod
Kaeru Gaman wrote:srod wrote:Is it not just the #COLOR_BTNFACE system color which you can retrieve with GetSysColor_() ?
no. there was something lately in the german forums...
if I remember correctly, it strongly depends on the skinning.
if it's the same as ButtonFace, it's just a coincidence.
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.
@Denis : works fine here with a disabled ListIcon inside an nxSplitter. If you create the ListIcon with zero width and height (ready for the splitter) then only use netty's code after placing the control inside the splitter; otherwise you will get a color value of -1 ($ffffffff). As I say, works fine here.
Posted: Mon May 25, 2009 6:49 pm
by Denis
srod wrote:
@Denis : works fine here with a disabled ListIcon inside an nxSplitter. If you create the ListIcon with zero width and height (ready for the splitter) then only use netty's code after placing the control inside the splitter; otherwise you will get a color value of -1 ($ffffffff). As I say, works fine here.
Ok srod, i will try this.
Posted: Mon May 25, 2009 6:56 pm
by srod
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.