View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0020777||Lazarus||LCL||public||2011-11-29 22:47||2011-12-10 13:38|
|Reporter||wp||Assigned To||Jesus Reyes|
|Product Version||0.9.31 (SVN)|
|Fixed in Version||0.9.31 (SVN)|
|Summary||0020777: Extended grid and dbgrid|
|Description||The attachment contains extended versions of grids.pas and dbgrids.pas which implement a few additional features that I have been missing so far:|
- the options goCellEllipsis and dgCellEllipsis for TCustomGrid/TStringGrid and TDBGrid, respectively, allow to display '...' at the end of cell texts that are wider than the cell rect
- the options goTruncCellHints/dgTruncCellHints allow to show a hint popup window if the cell text is truncated within the cell rectangle. Since this hint window is just the regular hint of the grid the ShowHint property must be activated for this option to work.
- the options goCellHints/dgCellHints allow to display an individual hint for each cell. The hint text is defined by the event handler for OnGetCellHint. Again, the ShowHint property needs to be set.
The zip file contains also two projects to demonstrate these options with a TStringGrid and a TDBGrid (the latter demo is a modified dblookup demo in the Lazarus examples folder).
I would appreciate if these modifications could be added to the Lazarus units.
|Additional Information||The modifications of grids.pas and dbgrids.pas were made with the trunc versions of r33660.|
|Tags||No tags attached.|
|Fixed in Revision||34018|
ExtendedGrids.zip (100,818 bytes)
Thanks, initially I commited the changes about hints in grids.pas, see r33878.
The change about ending ellipsis was not included because two problems: it uses function DrawText which ignores canvas TextStyle which users can modify in OnPrepareCanvas event to change the way text is displayed, the other problem is that DT_END_ELLIPSIS is not implemented under gtk2. My suggestion is to implement this feature using TextStyle.EndElipsis:boolean (false by default) for example, then modify Canvas.TextRect to add this new type. With this change we can implement the ending ellipsis in grids, finally gtk2 should also implement this new text style. I don't know if the other widgetsets have ending ellipsis functionality built in.
The changes in dbgrid were not included because the OnGetCellHint event uses col,row arguments. In dbgrid such values are of limited use because dbgrid do not handle cols/rows but records/fields(columns). So my suggestion to implement this event is to use TColumn instead of Col,Row. and change active record before the event is triggered and restored after. I'm not sure what to do about a hint on indicator column.
What you think?.
||A comment on my code in "ShowCellHintWindow": it duplicates some code from DrawRow. Maybe it would be better to have a function GetGridDrawState(ACol,ARow: Integer): TGridDrawState which would be called from both places.|
||Feel free to refactor it as need it. Just check that everything works as before.|
ExtendedGrids-v2.zip (132,882 bytes)
According to your suggesttions, I just uploaded a new version of modified units and demos which
- adds TextEllipsis to the TextStyle and modifies Graphics.pp and Canvas.inc accordingly. DrawText is avoided now.
- implements a new OnGetCellHint event for DBGrid which uses columns instead of Col/Row. Care was taken to avoid unnecessary moving of the active record.
- implements a GetGridDrawState function
Since the modification in graphics.pp is quite fundamental, do you want me to post this as a separate request?
ExtendedGrids-v3.zip (131,980 bytes)
A few minor modifications:
- Renamed the "TextEllipsis" to "EndEllipsis" - this fits better to DT_END_ELLIPSIS.
- Added a new property CellHintStyle which provides some strategy on how to handle the case when multiple hint strings are available for the same cell: the general hint of the grid, the hint text obtained for each cell from the OnGetCellHint event, and/or the hint for truncated cells.
||This is a final modification: CellHintStyle should be called CellHintPriority -- see v4|
ExtendedGrids-v4.zip (133,465 bytes)
Next time please attach diffs against current svn. thanks.
|2011-11-29 22:47||wp||New Issue|
|2011-11-29 22:47||wp||File Added: ExtendedGrids.zip|
|2011-11-30 08:15||Zeljan Rikalo||Status||new => assigned|
|2011-11-30 08:15||Zeljan Rikalo||Assigned To||=> Jesus Reyes|
|2011-12-01 03:35||Jesus Reyes||LazTarget||=> -|
|2011-12-01 03:35||Jesus Reyes||Note Added: 0054610|
|2011-12-01 03:35||Jesus Reyes||Status||assigned => feedback|
|2011-12-01 08:48||wp||Note Added: 0054612|
|2011-12-01 09:02||wp||Note Added: 0054613|
|2011-12-02 22:15||Jesus Reyes||Note Added: 0054660|
|2011-12-03 00:26||wp||File Added: ExtendedGrids-v2.zip|
|2011-12-03 00:37||wp||Note Added: 0054661|
|2011-12-03 16:14||wp||File Added: ExtendedGrids-v3.zip|
|2011-12-03 16:22||wp||Note Added: 0054668|
|2011-12-03 16:23||wp||Note Edited: 0054668|
|2011-12-03 16:23||wp||Note Edited: 0054668|
|2011-12-03 16:31||wp||Note Added: 0054669|
|2011-12-03 16:32||wp||File Added: ExtendedGrids-v4.zip|
|2011-12-07 07:04||Jesus Reyes||Fixed in Revision||=> 34018|
|2011-12-07 07:04||Jesus Reyes||LazTarget||- => 0.99.0|
|2011-12-07 07:04||Jesus Reyes||Status||feedback => resolved|
|2011-12-07 07:04||Jesus Reyes||Fixed in Version||=> 0.9.31 (SVN)|
|2011-12-07 07:04||Jesus Reyes||Resolution||open => fixed|
|2011-12-07 07:04||Jesus Reyes||Note Added: 0054765|
|2011-12-07 07:05||Jesus Reyes||Target Version||=> 0.99.0|
|2011-12-10 13:38||wp||Status||resolved => closed|