Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Make the whole row of the grid to use the same forecolor
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00525731
Message ID:
00525751
Views:
17
This message has been marked as the solution to the initial question of the thread.
>>>>>Hi everybody,
>>>>>
>>>>>I have a grid, in which I set dynamicforecolor for all columns depending on status field value, e.g.
>>>>>
>>>>>.setall('DynamicForeColor', "thisform.myforecolor(BldMstr."+thisform.AddrField+")", 'Column')
>>>>>
>>>>>It sets correctly the dynamic forecolor except for the active column. In other words, if I set dynamic forecolor to blue, all columns show blue forecolor, but the active one shows black. Is it possible to make it blue too?
>>>>>
>>>>>Thanks in advance.
>>>>
>>>>Yes, but for the active column you need to manpulate its CurrentControl ForeColor i.e. set textbox.ForeColor to blue.
>>>
>>>Hi Nick,
>>>
>>>I tried to set textbox forecolor to blue in textbox.GotFocus, but it doesn't seem to be any effect. Do you know, what exactly I have to do? That's not a big problem, but I like to have the whole row in one forecolor... BTW, I use your gridhighlighter, if it makes any difference.
>>
>>Grid Highlighter does highlighting of the whole row with the same distinct forecolor by default (that means I know exactly what to do :), why do you need extra code for the same task?
>
>Hi Nick,
>
>I place code in OnSetDynamicColor of this class. I instantiate it in run-time. If some conditions are met, I want ForeColor for this record to be different, say, blue, green or red. Everything works fine, except that active column is displayed in black. Or can I set GridHighlighter highlightforecolor to be myfunction?

In simplest case, if you did not move columns around and assuming that all columns have textboxes you can place the following in OnPostHighlightRow() method:
lcHost = THIS.chostname
lnColumn = THIS.PARENT.&lcHost..ActiveColumn
loControl = THIS.PARENT.&lcHost..Columns(lnColumn).Text1
loControl.ForeColor = < your conditional color here or IIF returning it >
If not - before you set that forecolor, you will need more code to determine also which column is really ActiveColumn, which control in it is CurrentControl, does that CurrentControl have ForeColor property.
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform