View Issue Details

IDProjectCategoryView StatusLast Update
0004972JEDI VCL00 JVCL Componentspublic2011-09-21 14:10
ReporterVelhoMongeAssigned ToAHUser 
PrioritynormalSeverityfeatureReproducibilityhave not tried
Status resolvedResolutionfixed 
Product Version3.38 
Target VersionFixed in Version3.45 
Summary0004972: Double-click to resize a column in JvDbGrid (Like ListView)

I would like to implement a JvDBgrid Double-click Resizing event, (when the cursor is "CrHSplit") - like columns in a listview (only in vsreport style), that after doubleclicked, the columns auto-resizing. How I do it?

Note: The TMSsoftware Dataware component - DBADVgrid - can do it.
TagsNo tags attached.



2009-12-04 14:40

administrator   ~0016928

I'm not sure how to do it, but if you find a way, please tell us how you did


2011-06-20 16:34

reporter   ~0018789

Code is ready.

Note: New code is commented { My code } for quick search.
Unit: JvDBGrid_2011-06-20.pas

2011-06-20 16:35


JvDBGrid_2011-06-20.pas (160,095 bytes)


2011-06-20 19:32

reporter   ~0018791

Updated code.
Feature added: When resize DO NOT trigger title DblClick event.

2011-06-20 19:32


JvDBGrid.pas (160,445 bytes)


2011-06-21 10:21

developer   ~0018795

Last edited: 2011-06-21 10:21

You have introduced the ADODataSet into the component. Doesn't GotoBookmark work for it? I don't like to introduce a specific DataSet into an unspecific component.


2011-06-21 13:01

reporter   ~0018797

Yes, of cource it works, and I agree with you, but there is a problem though.

Let's say that the current record is near the bottom of the grid.
Then DataSet.GotoBookmark will scroll the grid downwards and position the current record at the center fetching new rows.
This is not good in case new records have Length(Field.DisplayText) larger than the one already calculated by GetColumnMaxWidth.

1) The result whould be the DisplayText of these rows to be cut off.
2) The second problem of reposition the current record is that the user needs the rows of the grid not to move.

The only solution I checked so far is specific code for TADODataSet.
If there is a solution for TDataSet that whould be more than welcome.


2011-06-21 13:53

developer   ~0018798

In the crDataSet mode there shouldn't be a problem with GotoBookmark. And in the other case, wouldn't it be enough to set ActiveRecord to the old position?


2011-06-21 16:10

reporter   ~0018800

Can you make a EXE demo? Unfortunatly without delphi (at moment)....


2011-06-21 18:05

reporter   ~0018801

1) Update: Memo fields did not resize right, so for ftMemo fields I used the AsString property.

2) The problem is in DataSet.GotoBookmark method, it use Resync([rmExact, rmCenter]) instead of Resync([rmExact]).
ActiveRecord didn't seem to help, any suggestions?

2011-06-21 18:12


JvDBGrid_2011-06-21.pas (160,775 bytes)


2011-06-22 22:53

reporter   ~0018802

DataSet.GotoBookmark Resync issue resolved. (Mantis 5605)


2011-07-10 12:03

developer   ~0018815

The changes are applied in svn revision 13085.

I have renamed the "crNone, cr..." enumeration elements to "gcrNone, gcr..." to prevent a conflict with TCursor.

Instead of using your TJvDataSet.GotoBookmark, I've introduced JvDBUtils.pas::GotoBookmarkEx.

The patch includes the JvDBGrid.pas changes from Mantis 0005605.

Issue History

Date Modified Username Field Change
2009-10-07 15:11 VelhoMonge New Issue
2009-12-04 14:40 obones Note Added: 0016928
2009-12-04 14:40 obones Status new => acknowledged
2011-06-20 16:34 stevegr Note Added: 0018789
2011-06-20 16:35 stevegr File Added: JvDBGrid_2011-06-20.pas
2011-06-20 19:32 stevegr Note Added: 0018791
2011-06-20 19:32 stevegr File Added: JvDBGrid.pas
2011-06-21 10:21 AHUser Note Added: 0018795
2011-06-21 10:21 AHUser Assigned To => AHUser
2011-06-21 10:21 AHUser Status acknowledged => feedback
2011-06-21 10:21 AHUser Note Edited: 0018795
2011-06-21 13:01 stevegr Note Added: 0018797
2011-06-21 13:53 AHUser Note Added: 0018798
2011-06-21 16:10 VelhoMonge Note Added: 0018800
2011-06-21 18:05 stevegr Note Added: 0018801
2011-06-21 18:12 stevegr File Added: JvDBGrid_2011-06-21.pas
2011-06-22 22:53 stevegr Note Added: 0018802
2011-07-10 12:03 AHUser Note Added: 0018815
2011-07-10 12:03 AHUser Status feedback => resolved
2011-07-10 12:03 AHUser Fixed in Version => Daily / SVN
2011-07-10 12:03 AHUser Resolution open => fixed
2011-09-21 14:10 obones Fixed in Version Daily / SVN => 3.45