Page 1 of 1

Replacement for DBMemo.Font.Color / Visual disable Control?

Posted: Wed May 12, 2010 10:05 am
by Bjoern
I'm using a DBRichViewEdit (as a replacement of a DBMemo) and some DBEdits on a DBCtrlGrid.
In some cases i must show the user that a data-record is disabled, so far i used the OnPaintPanel-Event of the DBCtrlGrid with

Code: Select all

if (MyDBCtrlGrid.DataSource.DataSet.FieldByName('disabled').AsBoolean) then
begin
   MyDBEdit.Enabled:= False;
   MyDBMemo.Enabled:= False;
   MyDBMemo.Font.Color := clGray;
end
else
begin
   MyDBEdit.Enabled:= True;
   MyDBMemo.Enabled:= True;
   MyDBMemo.Font.Color := clBlack;
end;
so both Controls, the DBEdit and the DBMemo shows the user that editing is disabled.

At the DBRichViewEdit there is no .Font and when i loop through the TextStyles and set all Fontcolors for all styles to gray, then the original-color is lost when the data-record is enabled again.

Is there any alternative to make all fonts gray, only viewable at the control, no change in the database?

Posted: Wed May 12, 2010 11:55 am
by Sergey Tkachenko
Sorry, no. May be you can assign DBRichViewEdit.Color := clBtnFace instead?

Posted: Wed May 12, 2010 12:33 pm
by Bjoern
I'll try this and to make the DBEdit.Color darker too when disabled.
Maybe something for the next version of TRichViewEdit, a property like .DisabledFontColor?

Posted: Wed May 12, 2010 1:08 pm
by Sergey Tkachenko
Will be in the next update