Components for Delphi and C++ Builder.

Go to Russian forum
Go to EhLib.com
It is currently 20 Apr 2024, 06:08

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: 27 Aug 2019, 10:59 
Offline

Joined: 13 Jul 2019, 19:08
Posts: 91
i need to use dgRowSelect
however you do not have the focu with the selection when using the following code.

I can't focus the Grid and see the selected line when I use the "OnDrawColumnCell" event see this example in Attachment.

Code:
procedure TForm1.GridDadosDrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumnEh; State: TGridDrawState);
Var Value: String;
begin
Value := GridDados.DataSource.DataSet.FieldByName('CODIGO').Asstring;

if (Value = '6') Or (Value = '9') then begin
  GridDados.Canvas.Font.Style := [fsBold];
  GridDados.Canvas.Font.Color := ClBlue;
end;

GridDados.DefaultDrawColumnCell(Rect, DataCol, Column, State);

end;


This link has an example.
https://mega.nz/#!Ymhk2IzY!0wP5j6F14dHlzjDXXz6lKgMeM2nr5Ykelv8Ycd2-GQI

Another thing I would like to use Delphi's TDBGrid and cast to TDbGridEh I will have to do this because I will use the same project using Copying Directives for the same application I will have it in VCL and WEB using Unigui so I will control by copying directives.

So in order to leave TDbGrid and cast I am having problems with the "Expanded" property that exists in TDbGrid I tried to make this code below and couldn't see it:

Code:
Type
TLFColumn = Class(DBGridEh.TDBGridColumnEh)
Private
  FExpanded: Boolean;
published
  property Expanded: Boolean read FExpanded write FExpanded;
End;

Type
TDBGrid = Class(DBGridEh.TDBGridEh)
Private
  LFColumn: TLFColumn;
published
  property Columns: TLFColumn read LFColumn write LFColumn;
End;


Top
 Profile  
 
PostPosted: 27 Aug 2019, 17:35 
Offline

Joined: 08 May 2014, 18:06
Posts: 663
Hello

1----
Unfortunately, the functionality of the method DefaultDrawColumnCell very limited.

If you want to change Font or cell Background use OnGetCellParams event like this:

Code:
procedure TForm1.GridDadosGetCellParams(Sender: TObject; Column: TColumnEh;
  AFont: TFont; var Background: TColor; State: TGridDrawState);
Var
  Value: String;
begin
Value := GridDados.DataSource.DataSet.FieldByName('CODIGO').Asstring;

if (Value = '6') Or (Value = '9') then
begin
   AFont.Style := [fsBold];
   AFont.Color := ClBlue;
end;
end;


2--About TDBGrid and cast to TDbGridEh
TDbGridEh class is not a descendant of TDBGrid.
So it is not possible to cast TDBGrid to TDbGridEh.

Can you describe the end result that you want to get?
Perhaps it is decided differently.

_________________
Best regards
EhLib Support Team


Top
 Profile  
 
PostPosted: 27 Aug 2019, 18:29 
Offline

Joined: 13 Jul 2019, 19:08
Posts: 91
I will have the same project that I will compile for VCL and for WEB for VCL I will use EhLib and for WEB I will use Unigui, so I will leave TDbGrid and through copying directives I will cast to change Grid classes.

See this new example I sent you attached run it to see the error.
https://mega.nz/#!krQGWASK!l8XA_A-HnT8ISs8t96y-T0AfgwGyV4BkcNhuz_uNM0g


Another thing I would like to change the color of the Grid Focu, currently is using a Light Blue I would like to put a Red or Green how could I do this?

I read in the documentation if this can be changed in the property.
"SelectionDrawParams.SelectionStyle" however I didn't find where to change the focu color.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 11 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group