Combobox: How to color items

User avatar
MarcoBoschi
Posts: 925
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy
Contact:

Combobox: How to color items

Post by MarcoBoschi »

Is it possibile to color each item of a Combobox with a different color?
King Regards
Marco
Marco Boschi
info@marcoboschi.it
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Combobox: How to color items

Post by Antonio Linares »

Marco,

Please review FWH\samples\ownerdra.prg
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
MarcoBoschi
Posts: 925
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy
Contact:

Re: Combobox: How to color items

Post by MarcoBoschi »

VeryGood :D
Marco Boschi
info@marcoboschi.it
User avatar
MarcoBoschi
Posts: 925
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy
Contact:

Re: Combobox: How to color items

Post by MarcoBoschi »

Antonio,
not all bitmaps are correctly displayed
I open yellow.bmp using Paint I draw another color using brush and save
But I cannot see correctly the bitmap
Marco Boschi
info@marcoboschi.it
User avatar
MarcoBoschi
Posts: 925
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy
Contact:

Re: Combobox: How to color items

Post by MarcoBoschi »

This is bmp file modified
Image

This is one of correct bitmaps

Image
Marco Boschi
info@marcoboschi.it
User avatar
cnavarro
Posts: 5792
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Combobox: How to color items

Post by cnavarro »

Run ok for me

Image
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
User avatar
Marc Venken
Posts: 727
Joined: Tue Jun 14, 2016 7:51 am

Re: Combobox: How to color items

Post by Marc Venken »

Hello Christobal,

Could you share the code for the combo with the colors insite ?
Marc Venken
Using: FWH 20.08 with Harbour
User avatar
cnavarro
Posts: 5792
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Combobox: How to color items

Post by cnavarro »

Marc Venken wrote:Hello Christobal,

Could you share the code for the combo with the colors insite ?
Look post of Antonio
Antonio Linares wrote:Marco,

Please review FWH\samples\ownerdra.prg
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
User avatar
MarcoBoschi
Posts: 925
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy
Contact:

Re: Combobox: How to color items

Post by MarcoBoschi »

Cristobal,
if you download this bmp file http://www.marcoboschi.it/public/rosso.bmp
and subsititute one of bmp files you can see that there is a problem
You cannot see the bitmap rosso.bmp

The question is: these bmp files are particular bmp files?


screenshot
Image
Marco Boschi
info@marcoboschi.it
User avatar
cnavarro
Posts: 5792
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Combobox: How to color items

Post by cnavarro »

Ah!, ok, I will try
Send me your image original
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: Combobox: How to color items

Post by ukoenig »

A test

Image

Image

Image

Image

Image

Image

Image

Code: Select all

REDEFINE COMBOBOX oCbx2 VAR cItem4 ;
ID 140 OF oDlg ;
ITEMS   { "   White", "   Blue", "   Rosso", "   Yellow", "   Green", "   Red" } ;
BITMAPS { c_path + "sWhite.bmp",;
                c_path + "sBlue.bmp",;
                c_path + "sRosso.bmp",;
                c_path + "sYellow.bmp",;
               c_path + "sGreen.bmp",;
               c_path + "sRed.bmp" }
oCbx2:nItemHeight( 22 ) 
 
regards
Uwe :D
Last edited by ukoenig on Mon Feb 26, 2018 6:34 pm, edited 4 times in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Combobox: How to color items

Post by nageswaragunupudi »

The bitmaps are drawn, treating the color at pixel 0,0 as transparent. In the case of rosso.bmp, color at (0,0) is same as the entire body of the bitmap, so the entire bitmap is treated as transparent.

Please choose a bitmap where the color at (0,0) is different from the rest of the bitmap
Regards

G. N. Rao.
Hyderabad, India
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: Combobox: How to color items

Post by ukoenig »

Rao,

the left upper corner is different in color
to show a black frame

Image

regards
Uwe :D
Last edited by ukoenig on Mon Feb 26, 2018 7:34 pm, edited 1 time in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Combobox: How to color items

Post by nageswaragunupudi »

Uwe

I am referring to the bitmap downloaded from http://www.marcoboschi.it/public/rosso.bmp, not the bmps you are using.
Yes. Because in your bitmaps 0,0 color is different from the rest of the colors, the painting is ok.
Regards

G. N. Rao.
Hyderabad, India
User avatar
MarcoBoschi
Posts: 925
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy
Contact:

Re: Combobox: How to color items

Post by MarcoBoschi »

Dear coders, thank you so much
Marco Boschi
info@marcoboschi.it
Post Reply