View Issue Details

IDProjectCategoryView StatusLast Update
0005233JEDI VCL04 Feature Requestpublic2012-02-29 16:55
ReporterZENsanAssigned ToAHUser 
PrioritynormalSeverityfeatureReproducibilityalways
Status resolvedResolutionfixed 
Product VersionDaily / GIT 
Target VersionFixed in Version3.45 
Summary0005233: TJvDBGrid wordwrap
DescriptionIt will be good to add special event for DbGrid called like "OnColumnWordwrap" returning bollean if drawed column must be wordwrapped.
If we allow row resizing, then really I see only OnDrawCell possibility for that or modifying source unit and then including it into project.
TagsNo tags attached.

Activities

obones

2010-06-07 13:49

administrator   ~0017452

Could you please provide the zipped sources of a sample application showing this?

2010-06-08 09:29

 

JvDbGridWordWrap.zip (1,353 bytes)

ZENsan

2010-07-09 14:09

reporter   ~0017532

Hello?

obones

2010-10-08 15:57

administrator   ~0017800

Thanks, someone with DB knowledge will have to look at this

ZENsan

2010-11-23 16:46

reporter   ~0018152

I just checked this issue again. So there is no problems with String Fields. If Grid.WordWrap is true, then everything goes fine. But Date fields and other fielda re not wordwrapped. That's strange...

2010-11-23 16:46

 

Clipboard-1.png (5,363 bytes)
Clipboard-1.png (5,363 bytes)

ZENsan

2010-11-23 16:55

reporter   ~0018153

That is because of:

on line 3450 of JvDBGrid.pas must be this text instead of previous:

if (Field.DataType in [ftString, ftWideString]) or WordWrap or (FShowMemos and ((Field.DataType in [ftMemo{$IFDEF COMPILER10_UP}, ftWideMemo{$ENDIF}]) then

ZENsan

2010-11-23 16:57

reporter   ~0018154

begin
      if (Field.DataType in [ftString, ftWideString]) or WordWrap or (FShowMemos and (Field.DataType in [ftMemo{$IFDEF COMPILER10_UP}, ftWideMemo{$ENDIF}])) then
      begin
        if Assigned(Field.OnGetText) then
          MemoText := Field.DisplayText
        else
          MemoText := Field.AsString;
        WriteCellText(Rect, 2, 2, MemoText, Column.Alignment,
          UseRightToLeftAlignmentForField(Field, Column.Alignment), False);
      end
      else
        DefaultDrawColumnCell(Rect, DataCol, Column, State);
    end;

This works like a magic.

ZENsan

2010-11-23 16:59

reporter   ~0018155

before there was check only for TSrtingField... And how About all ancestors, TWideStringField and so on.

I think checking datatype is quite good idea.

ZENsan

2010-11-24 09:10

reporter   ~0018159

begin
      if (Field.DataType in [ftString, ftWideString]) or WordWrap or (FShowMemos and (Field.DataType in [ftMemo{$IFDEF COMPILER10_UP}, ftWideMemo{$ENDIF}])) then
      begin
        if Assigned(Field.OnGetText) or not (Field.DataType in [ftString, ftWideString])then
          MemoText := Field.DisplayText
        else
          MemoText := Field.AsString;
        WriteCellText(Rect, 2, 2, MemoText, Column.Alignment,
          UseRightToLeftAlignmentForField(Field, Column.Alignment), False);
      end
      else
        DefaultDrawColumnCell(Rect, DataCol, Column, State);
    end;

This is correction for previous post.

AHUser

2010-11-28 12:03

developer   ~0018206

Fixed in svn revision 12927.
There is now a "WordWrapAllFields: Boolean default False" property.


@ZENsan: The check for "Field is TStringField" also includes the TWideStringField because it derives from it and the is-operator handles this.

Issue History

Date Modified Username Field Change
2010-05-10 08:50 ZENsan New Issue
2010-06-07 13:49 obones Note Added: 0017452
2010-06-07 13:49 obones Status new => feedback
2010-06-08 09:29 ZENsan File Added: JvDbGridWordWrap.zip
2010-07-09 14:09 ZENsan Note Added: 0017532
2010-10-08 15:57 obones Note Added: 0017800
2010-10-08 15:57 obones Status feedback => acknowledged
2010-11-23 16:46 ZENsan Note Added: 0018152
2010-11-23 16:46 ZENsan File Added: Clipboard-1.png
2010-11-23 16:55 ZENsan Note Added: 0018153
2010-11-23 16:57 ZENsan Note Added: 0018154
2010-11-23 16:59 ZENsan Note Added: 0018155
2010-11-24 09:10 ZENsan Note Added: 0018159
2010-11-28 12:03 AHUser Note Added: 0018206
2010-11-28 12:03 AHUser Status acknowledged => resolved
2010-11-28 12:03 AHUser Fixed in Version => Daily / SVN
2010-11-28 12:03 AHUser Resolution open => fixed
2010-11-28 12:03 AHUser Assigned To => AHUser
2012-02-29 16:55 obones Fixed in Version Daily / SVN => 3.45