Combobox: How to color items

Combobox: How to color items

Postby MarcoBoschi » Fri Feb 23, 2018 3:01 pm

Is it possibile to color each item of a Combobox with a different color?
King Regards
Marco
User avatar
MarcoBoschi
 
Posts: 1012
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: Combobox: How to color items

Postby Antonio Linares » Fri Feb 23, 2018 4:40 pm

Marco,

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41206
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Combobox: How to color items

Postby MarcoBoschi » Fri Feb 23, 2018 4:44 pm

VeryGood :D
User avatar
MarcoBoschi
 
Posts: 1012
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: Combobox: How to color items

Postby MarcoBoschi » Mon Feb 26, 2018 10:04 am

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
User avatar
MarcoBoschi
 
Posts: 1012
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: Combobox: How to color items

Postby MarcoBoschi » Mon Feb 26, 2018 11:17 am

This is bmp file modified
Image

This is one of correct bitmaps

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

Re: Combobox: How to color items

Postby cnavarro » Mon Feb 26, 2018 1:40 pm

Run ok for me

Image
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6498
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Combobox: How to color items

Postby Marc Venken » Mon Feb 26, 2018 2:02 pm

Hello Christobal,

Could you share the code for the combo with the colors insite ?
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1338
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Combobox: How to color items

Postby cnavarro » Mon Feb 26, 2018 2:09 pm

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
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6498
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Combobox: How to color items

Postby MarcoBoschi » Mon Feb 26, 2018 3:31 pm

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
User avatar
MarcoBoschi
 
Posts: 1012
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: Combobox: How to color items

Postby cnavarro » Mon Feb 26, 2018 3:33 pm

Ah!, ok, I will try
Send me your image original
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6498
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Combobox: How to color items

Postby ukoenig » Mon Feb 26, 2018 6:16 pm

A test

Image

Image

Image

Image

Image

Image

Image

Code: Select all  Expand view

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
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Combobox: How to color items

Postby nageswaragunupudi » Mon Feb 26, 2018 6:20 pm

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
nageswaragunupudi
 
Posts: 10207
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Combobox: How to color items

Postby ukoenig » Mon Feb 26, 2018 6:28 pm

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
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Combobox: How to color items

Postby nageswaragunupudi » Mon Feb 26, 2018 7:02 pm

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
nageswaragunupudi
 
Posts: 10207
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Combobox: How to color items

Postby MarcoBoschi » Mon Feb 26, 2018 7:50 pm

Dear coders, thank you so much
User avatar
MarcoBoschi
 
Posts: 1012
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 12 guests