#1 2013-05-15 08:19:00

esmondb
Member
From: London
Registered: 2010-07-20
Posts: 299

TSQLTableToGrid default row height

I've got a problem changing the font when creating a TSQLTableToGrid in a form's onShow event.

  DrawGrid.Font.Size := 12;
  TableToGrid := TSQLTableToGrid.Create(DrawGrid, Table, database);

The Drawgrid font size gets set ok but the row height gets adjusted to the smaller default font size by the following lines in TSQLTableToGrid.Create

with aOwner.Canvas.TextExtent('jQH°;') do
    aOwner.DefaultRowHeight := cy+4;

I only get the problem if creating the TSQLTableToGrid in the form's onShow event.

Any suggestions on getting this working?

Thanks

Offline

#2 2013-05-15 13:37:40

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,660
Website

Re: TSQLTableToGrid default row height

Does

aOwner.Canvas.Font := aOwner.Font;
with aOwner.Canvas.TextExtent('jQH°;') do
    aOwner.DefaultRowHeight := cy+4;

fix the issue?

Offline

#3 2013-05-15 13:59:04

esmondb
Member
From: London
Registered: 2010-07-20
Posts: 299

Re: TSQLTableToGrid default row height

Yes, that fixes the issues. Could you update mORMotUI.

Many thanks

Offline

#4 2013-05-15 14:43:38

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,660
Website

Re: TSQLTableToGrid default row height

Now TSQLTableToGrid.Create() uses TDrawGrid font to compute row height.
See http://synopse.info/fossil/info/f3ccffea59

Thanks for the report.

Offline

Board footer

Powered by FluxBB