FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Combobox: How to color items
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Combobox: How to color items
Posted: Fri Feb 23, 2018 03:01 PM

Is it possibile to color each item of a Combobox with a different color?
King Regards
Marco

Marco Boschi
info@marcoboschi.it
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Combobox: How to color items
Posted: Fri Feb 23, 2018 04:40 PM

Marco,

Please review FWH\samples\ownerdra.prg

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: Combobox: How to color items
Posted: Fri Feb 23, 2018 04:44 PM

VeryGood :D

Marco Boschi
info@marcoboschi.it
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: Combobox: How to color items
Posted: 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

Marco Boschi
info@marcoboschi.it
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: Combobox: How to color items
Posted: Mon Feb 26, 2018 11:17 AM
This is bmp file modified


This is one of correct bitmaps

Marco Boschi
info@marcoboschi.it
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Combobox: How to color items
Posted: Mon Feb 26, 2018 01:40 PM
Run ok for me

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
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Re: Combobox: How to color items
Posted: Mon Feb 26, 2018 02:02 PM

Hello Christobal,

Could you share the code for the combo with the colors insite ?

Marc Venken

Using: FWH 23.08 with Harbour
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Combobox: How to color items
Posted: Mon Feb 26, 2018 02: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
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: Combobox: How to color items
Posted: Mon Feb 26, 2018 03: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
Marco Boschi
info@marcoboschi.it
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Combobox: How to color items
Posted: Mon Feb 26, 2018 03: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
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Combobox: How to color items
Posted: Mon Feb 26, 2018 06:16 PM
A test















Code (fw): Select all Collapse
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 :-)
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.
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Combobox: How to color items
Posted: Mon Feb 26, 2018 06: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
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Combobox: How to color items
Posted: Mon Feb 26, 2018 06:28 PM
Rao,

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



regards
Uwe :-)
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.
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Combobox: How to color items
Posted: Mon Feb 26, 2018 07: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
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: Combobox: How to color items
Posted: Mon Feb 26, 2018 07:50 PM
Dear coders, thank you so much
Marco Boschi
info@marcoboschi.it