Components for Delphi and C++ Builder.

Go to Russian forum
Go to EhLib.com
It is currently 21 Sep 2019, 19:57

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Display of null values
PostPosted: 03 Jun 2019, 22:04 
Offline

Joined: 03 Jun 2019, 22:02
Posts: 2
Hi,

how is it possible to display 'NULL' in the cells when the values in the dataset are null ?
(no column is defined, i do not know at design time the number of columns)

Regards

Halted


Top
 Profile  
 
PostPosted: 04 Jun 2019, 09:46 
Offline

Joined: 03 Jun 2019, 22:02
Posts: 2
I answer to myself just in case it's useful for someone ;o)

procedure TframeSql.gridResultDrawDataCell(Sender: TObject; const Rect: TRect; Field: TField; State: TGridDrawState);
var
lnWidth : integer;
begin
if field.IsNull then with (Sender as TDBGridEh) do begin
Canvas.Font.Color := clDkGray;
// Canvas.Font.Style := [fsItalic];
lnWidth := Canvas.TextWidth('NULL');
Canvas.TextOut(Rect.Left + (Rect.Width - lnWidth) div 2 ,Rect.Top +1 ,'NULL');
end;
end;


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

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 1 guest


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:  
Powered by phpBB® Forum Software © phpBB Group