DCCOMBOBOX PRESENTATION will not set disabled color

This forum is for eXpress++ general support.
Post Reply
Message
Author
rsmarks
Posts: 27
Joined: Tue Nov 26, 2013 9:19 pm

DCCOMBOBOX PRESENTATION will not set disabled color

#1 Post by rsmarks »

If the WHEN clause is False, DCCOMBOBOX will gray the text and the PRESENTATION clause will not override this. i.e.
aPres:={ { XBP_PP_FGCLR, GRA_CLR_BLACK }, ;
{ XBP_PP_BGCLR, GRA_CLR_WHITE }, ;
{ XBP_PP_DISABLED_FGCLR, GRA_CLR_BLACK }, ;
{ XBP_PP_DISABLED_BGCLR, GRA_CLR_BACKGROUND } }
@ 0,0 DCCOMBOBOX cPick LIST aChoices SIZE 10,10 WHEN {|| .F.} PRESENTATION aPres

I would expect the text to be Black, but it is Gray. How do I make the text color Black if WHEN is False?

Thx,

Bob

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: DCCOMBOBOX PRESENTATION will not set disabled color

#2 Post by rdonnay »

Some Xbase parts don't always work as advertised.

You could try a workaround by using EditProtect instead of When..

EDITPROTECT {|o,x| x:= .t., o:setColorFG(IIF(x,GRA_CLR_BLACK,GRA_CLR_BACKGROUND)), o:setColorBG(IIF(x,GRA_CLR_BLACK,GRA_CLR_WHITE))}
The eXpress train is coming - and it has more cars.

rsmarks
Posts: 27
Joined: Tue Nov 26, 2013 9:19 pm

Re: DCCOMBOBOX PRESENTATION will not set disabled color

#3 Post by rsmarks »

Using this, I get a runtime error:
Description: Receiver of message is not an object.
Operation: setColorFG

User avatar
Auge_Ohr
Posts: 1428
Joined: Wed Feb 24, 2010 3:44 pm

Re: DCCOMBOBOX PRESENTATION will not set disabled color

#4 Post by Auge_Ohr »

hi Bob,

did you talk about "List" Part or SLE Part of Combobox ?

if you want to change Color of SLE you have to use

Code: Select all

oCombobox:XbpSLE:SetColorFG()
oCombobox:XbpSLE:SetColorGG()
if you talk about "List" Part : use Ownerdraw
greetings by OHR
Jimmy

rsmarks
Posts: 27
Joined: Tue Nov 26, 2013 9:19 pm

Re: DCCOMBOBOX PRESENTATION will not set disabled color

#5 Post by rsmarks »

It was the SLE part I was concerned with. On further testing, I found that the first time EDITPROTECT is processed, the object is undefined. I had to insert a test to make sure the object was actually being passed. Then, I inserted your modification. It kind of worked as expected, but the colors were not set initially, only after the object was clicked on.

Thx

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: DCCOMBOBOX PRESENTATION will not set disabled color

#6 Post by rdonnay »

but the colors were not set initially, only after the object was clicked on.
You can set the colors initially with the COLOR clause of the DCCOMBOBOX.
The eXpress train is coming - and it has more cars.

rsmarks
Posts: 27
Joined: Tue Nov 26, 2013 9:19 pm

Re: DCCOMBOBOX PRESENTATION will not set disabled color

#7 Post by rsmarks »

The COLOR clause just seems to act on the List, not the SLE, which is where I need it to work.

For consistency, I like the active Gets and ComboBox SLE's to have black lettering on white background.
I like the disabled Gets and ComboBox SLE's to use the default background color to show that they are not active, but I find the default grey lettering on this background hard to see in our environment when you are not right in front of the screen. However, black lettering works great. That being said, it looks like the best solution may be to use EDITPROTECT and not visually differentiate active and disabled ComboBoxes.

Thanks for all your help.

Post Reply