Subject RE: [IBO] Using colorscheme
Author Paul Vinkenoog
Hello Helen,

>> As I have only one such control in couple of forms, then the
>> easiest solution is to put checks to OnStateChanged event and write
>> if(state=dssEdit)
>> c->color=...
>> etc.

> I still think you must call Inherited *first*, since this will cause
> the colour change in the IB_components to take effect. Then add
> your code to simply copy the (newly current) colour of an
> IB_component. You should not then have to check separately for the
> dataset state.

But he's writing an event handler, he's not overriding an ancestor
method. So I'm afraid there's no Inherited to call.

The thing is, TIB_DataSource calls the OnStateChanged handler (if it's
there) _before_ notifying the linked controls that the state has
changed. So from within your handler you'll find the new state but the
old color. At least if you ask the controls for their color.

His best option (I think) is to write a case/switch statement to
determine the state, and then ask Session or SessionProps what color
to use for that state. This way if he later changes his color
preferences, the handler still works correctly.

TIB_Session[Props].OnGetDataLinkColor would be even easier (for the
programmer) because when that's called, the colors have already been
updated so you only have to copy the color - one line of code.
But that one still feels "dirty" to me beacuse it's called lots of
times for every state change.

Greetings,
Paul Vinkenoog