Page 1 of 1

Listbox colours

Posted: Thu Mar 07, 2024 4:36 am
by clp1000
Hello

I'm trying to change the colour of a highlighted item in a XbpListbox() but for the life of me I've no idea where the colours are coming from
Currently the highlight bar is blue with white text, and when the box is disabled it's blue with a grey text ( very hard to see )
None of these attributes, below, seem to change anything

Alternatively, has anyone got an example of a CSS sheet for a Listbox, with various defined colours for highlighted items whilst the box is active or disabled ?

Thanks for any help
Chris

PUBLIC app10lbox := {{ XBP_PP_COMPOUNDNAME , "9.Courier" },;
{ XBP_PP_ACTIVE_CLR , GRA_CLR_RED },;
{ XBP_PP_INACTIVE_CLR , GRA_CLR_RED },;
{ XBP_PP_ACTIVETEXT_FGCLR , GRA_CLR_RED },;
{ XBP_PP_ACTIVETEXT_BGCLR , GRA_CLR_RED },;
{ XBP_PP_INACTIVETEXT_FGCLR , GRA_CLR_RED },;
{ XBP_PP_INACTIVETEXT_BGCLR , GRA_CLR_RED },;
{ XBP_PP_FGCLR , GRA_CLR_BLACK },;
{ XBP_PP_BGCLR , GRA_CLR_WHITE },;
{ XBP_PP_DISABLED_FGCLR , GRA_CLR_RED },;
{ XBP_PP_DISABLED_BGCLR , GRA_CLR_PALEGRAY }}

Re: Listbox colours

Posted: Fri Mar 08, 2024 8:07 am
by clp1000
Anyone ?
Just to confirm, I can't seem to change the colour blue/white on the left box ( enabled - left box) and blue/Grey ( disabled - right box )
Thanks
Chris
Listbox.jpg
Listbox.jpg (71.69 KiB) Viewed 2289 times

Re: Listbox colours

Posted: Mon Mar 11, 2024 12:57 am
by SlavkoDam
Hi,

This is not the way to change font and colors in a XbpListBox, with the XBP_PP_* parameters. You can do that with the XbpListBox owner-draw option, setting :drawMode = XBP_DRAW_OWNER, and using :drawItem() and :measureItem() methods.

To create a CSS sheet for a XbpListBox, use XbpListBox:visualStyle propery and XbpHTMLStyle() class. You have an example for that in the description of XbpComboBox:visualStyle property.

Slavko

Re: Listbox colours

Posted: Mon Mar 11, 2024 1:20 am
by k-insis
Slavko,

it would probably be easier to replace xbplistbox with xpbbrowse or xbpquickbrowse object on array than going through all the hassle of ownedraw


SlavkoDam wrote: Mon Mar 11, 2024 12:57 am Hi,

This is not the way to change font and colors in a XbpListBox, with the XBP_PP_* parameters. You can do that with the XbpListBox owner-draw option, setting :drawMode = XBP_DRAW_OWNER, and using :drawItem() and :measureItem() methods.

To create a CSS sheet for a XbpListBox, use XbpListBox:visualStyle propery and XbpHTMLStyle() class. You have an example for that in the description of XbpComboBox:visualStyle property.

Slavko

Re: Listbox colours

Posted: Mon Mar 11, 2024 2:10 am
by SlavkoDam
I don't agree with you. You cannot compare XbpListBox with XbpBrowse and XbpQuickBrowse. You cannot use XbpBrowse and XbpQuickBrowse as GET elements. XbpBrowse don't have :dataLink property, and in XbpQuickBrowse :dataLink property and :getData() method have different purposes. They also don't have :markMode and :multiColumn properties of XbpListBox, and you cannot define colors for disabled items. Besides, XbpBrowse and XbpQuickBrowse is much more complex to create than XbpListBox.

Owner-draw is not very hard to implement. You have examples in Xbase++ samples. Its not the point what is easier to achieve but what do you want to achieve. For advanced options you have to do advanced programming.

Re: Listbox colours

Posted: Mon Mar 11, 2024 2:37 am
by Tom
Roger implemented the "COMBO" clause for DCSAY ... GET, which uses a popup button beside a get field to show a browse for value selections. Maybe this will do the job.
But I also agree with Slavko. Ownerdrawing is no magic, and there are samples for that, even in your eXpress++-installation.

Re: Listbox colours

Posted: Mon Mar 11, 2024 3:58 am
by SlavkoDam
Tom,
Yes, its a fine option in eXpress++ and I implemented a similar one in my PowerWin. But, its only a help to select a value into a get field when you press a popup button, and not a direct get select as XbpListBox. To return to the beginning, the initial request was to change font and colors of active, selected and disabled items of XbpListBox, and that can be only done with owner-draw or HTML CSS style.

Slavko

Re: Listbox colours

Posted: Mon Mar 11, 2024 5:53 am
by Tom
Slavko, I know it's not the same. ;) But maybe it helps Chris to do what he wants to do.

Re: Listbox colours

Posted: Tue Mar 12, 2024 2:47 am
by clp1000
Thanks for the replies, I've worked out what was needed and used the DrawMode option
The Owner draw example worked well, once I'd stripped out all the code I wanted
Thanks once again
Chris
LB2.jpg
LB2.jpg (32.75 KiB) Viewed 2227 times