[Lazarus] The right way to handle variable heights of DBGrid rows
Andrey Smyntyna
andreysmyntyna at gmail.com
Sun May 27 22:49:12 CEST 2012
Good evening!
Sample project, covered this message theme is attached to the mail.
Screenshot that illustrates problem is attached too.
I went into task of displaying multiline text in DBGrid cells and have
success, but some features of the DBGrid scrolling is out of my
understanding.
If describe problem in short it lies in strange scrolling behaviour -
sometimes, selected row may be invisible for user, because it locates under
DBGrid
viewport or DBGrid can fill with records only half of visible area*. *
*
*
The code is very simple to understand:
1. TMyDBGrid is descendant of TCustomDBGrid, that overrides PrepareCanvas
procedure
2. Within PrepareCanvas routine I set TextStyle with SingleLine=False and
WrodBreak=True fields and also calculate dimentions of rectangle that can
hold multiline cell text.
3. Height of text I strore in corresponding element of RowHeights array.
All text appears multiline and well formated, but if you look at screenshot
the two facts are obvious: selected row can be displayed under the bottom
of the visible part of grid and grid itself sometimes displayed half filled.
So, the problem now: what things should I change to have correct scrolling.
Best Regards, Andrey Smyntyna
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20120527/01df408b/attachment-0003.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: variablescrolling.jpg
Type: image/jpeg
Size: 25907 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20120527/01df408b/attachment-0003.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MultilineDBGrid_lazarus_list.zip
Type: application/zip
Size: 4846 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20120527/01df408b/attachment-0003.zip>
More information about the Lazarus
mailing list