Page 1 of 1
DCCOMBOBOX PRESENTATION will not set disabled color
Posted: Mon Jun 08, 2015 4:10 pm
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
Re: DCCOMBOBOX PRESENTATION will not set disabled color
Posted: Mon Jun 08, 2015 7:19 pm
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))}
Re: DCCOMBOBOX PRESENTATION will not set disabled color
Posted: Mon Jun 08, 2015 8:09 pm
by rsmarks
Using this, I get a runtime error:
Description: Receiver of message is not an object.
Operation: setColorFG
Re: DCCOMBOBOX PRESENTATION will not set disabled color
Posted: Mon Jun 08, 2015 8:10 pm
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
Re: DCCOMBOBOX PRESENTATION will not set disabled color
Posted: Mon Jun 08, 2015 9:07 pm
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
Re: DCCOMBOBOX PRESENTATION will not set disabled color
Posted: Tue Jun 09, 2015 8:34 am
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.
Re: DCCOMBOBOX PRESENTATION will not set disabled color
Posted: Tue Jun 09, 2015 8:36 pm
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.