BkgndColor of disabled ListIcon

Everything else that doesn't fall into one of the other PB categories.
Denis
Enthusiast
Enthusiast
Posts: 790
Joined: Fri Apr 25, 2003 5:10 pm
Location: Doubs - France

BkgndColor of disabled ListIcon

Post 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
A+
Denis
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8453
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

Code: Select all

color = SendMessage_(<listicon>,#LVM_GETBKCOLOR,0,0)
Should work whether disabled or not.
BERESHEIT
Denis
Enthusiast
Enthusiast
Posts: 790
Joined: Fri Apr 25, 2003 5:10 pm
Location: Doubs - France

Post 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).
A+
Denis
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8453
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post 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 
BERESHEIT
Denis
Enthusiast
Enthusiast
Posts: 790
Joined: Fri Apr 25, 2003 5:10 pm
Location: Doubs - France

Post by Denis »

Hoouuuuu ! (it's so simple :roll: ) and it rocks :!:

i spend many time on it...

Many tks netmaestro
A+
Denis
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Is it not just the #COLOR_BTNFACE system color which you can retrieve with GetSysColor_() ?
I may look like a mule, but I'm not a complete ass.
User avatar
Fluid Byte
Addict
Addict
Posts: 2336
Joined: Fri Jul 21, 2006 4:41 am
Location: Berlin, Germany

Post by Fluid Byte »

srod wrote:Is it not just the #COLOR_BTNFACE system color which you can retrieve with GetSysColor_() ?
Yes, it is. :wink:
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8453
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

Ok you guys, if you're going to start making sense I don't know what I'm going to do! :D
BERESHEIT
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post 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! :D
Don't worry, it was just a rare moment of lucidity fuelled by a lack of alcohol! It won't happen again! :wink:
I may look like a mule, but I'm not a complete ass.
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6175
Joined: Sat May 17, 2003 11:31 am
Contact:

Post 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.
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB - upgrade incoming...)
( The path to enlightenment and the PureBasic Survival Guide right here... )
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post 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.
oh... and have a nice day.
Denis
Enthusiast
Enthusiast
Posts: 790
Joined: Fri Apr 25, 2003 5:10 pm
Location: Doubs - France

Post 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.
A+
Denis
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post 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.
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 : 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.
A+
Denis
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post 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.
I may look like a mule, but I'm not a complete ass.
Post Reply