Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 8 of 8 total
Thread TGridColumn ControlType = ctHTML wrapping problem
Sat, Dec 30 2017 8:44 PMPermanent Link

Allen Hunt

Hi,

This one is a little difficult to explain but I've included some screenshots.  

I have a TGridColumn with the ControlType set to ctHTML.  And when I have a URL that exceeds the width of the column the text is shifted downward where the user doesn't see the top of the first line it gets cutoff.  It appears when the text wraps the grid is not displaying the column results using a top left position.  Please see the Grid Using ctHTML ControlType For TGridColumn png.

I have it so when the user double clicks on the column it popups up a dialog to view how the text is suppose to look.  I should note (as an fyi) on the grid I'm actually removing the line feeds in order to display as much text as possible.

If I use a TGridColumn with the ControlType set to ctMultiLineEdit the behavior is fine however my goal is be be able to allow the user to click on urls (even if they don't see the full path) from within the grid so I think I really need to use a ControlType of ctHTML.  I've include a screen shot Grid Using ctMultiLineEdit ControlType For TGridColumn png so you can see how it's working.

Any tips to get the HTML text to display in the upper most top left position would be highly appreciated.  Thank you!

Best Regards,
Allen



Attachments: Grid Using ctHTML ControlType For TGridColumn.png
Sat, Dec 30 2017 8:45 PMPermanent Link

Allen Hunt

Grid Using ctMultiLineEdit ControlType For TGridColumn png attached



Attachments: Grid Using ctMultiLineEdit ControlType For TGridColumn.png
Sun, Dec 31 2017 5:05 AMPermanent Link

Uli Becker

Allen,

> Any tips to get the HTML text to display in the upper most top left position would be highly appreciated.  Thank you!

The position is controlled by the matching interface and the interface's
layout is set in the "UpdateWrap" procedure of TGridTextCell

The only way I know is to modify this procedure:

procedure TGridTextCell.UpdateWrap(AWrap: Boolean);
begin
   FCaptionElement.Format.Wrap:=AWrap;
   if AWrap and (TGridColumn(Owner).ControlType=ctMultiLineEdit) then
      begin
      FCaptionElement.Layout.Position:=lpTopLeft;
      FCaptionElement.Layout.Stretch:=lsBottomRight;
      end
   else
      begin
      // FCaptionElement.Layout.Position:=lpLeftCenter; <------ Change
      FCaptionElement.Layout.Position:=lpTopLeft; <------ Change
      FCaptionElement.Layout.Stretch:=lsRight;
      end;
end;

@Tim: Maybe it would be a good idea to add that as an option
(VerticalAlignment).

Cheers Uli
Sun, Dec 31 2017 5:17 AMPermanent Link

Uli Becker

Correction:

FCaptionElement.Layout.Stretch:=lsRight;

should be

FCaptionElement.Layout.Stretch:=lsBottomRight;

in the modified code.
Mon, Jan 1 2018 3:07 PMPermanent Link

Allen Hunt

Thanks Uli!  It works!

Best Regards,
Allen



Attachments: Grid Using ctHTML ControlType For TGridColumn.png
Tue, Jan 2 2018 4:12 AMPermanent Link

Matthew Jones

Uli Becker wrote:

>
> should be
>
> FCaptionElement.Layout.Stretch:=lsBottomRight;
>
> in the modified code.

If I read that correctly, that makes both side of the "if" the same result? Either the if needs removing, or it isn't doing what it is supposed to be. Tim will fathom it out I would guess.

--

Matthew Jones
Tue, Jan 2 2018 5:36 AMPermanent Link

Uli Becker

Matthew,
> If I read that correctly, that makes both side of the "if" the same result? Either the if needs removing, or it isn't doing what it is supposed to be. Tim will fathom it out I would guess.

Your are right:

this should be the correct version of what I meant:

 if AWrap  then
 begin
      FCaptionElement.Layout.Position:=lpTopLeft;
      FCaptionElement.Layout.Stretch:=lsBottomRight;
 end
 else
 begin
      FCaptionElement.Layout.Position:=lpLeftCenter;
      FCaptionElement.Layout.Stretch:=lsRight;
 end;

Uli
Wed, Jan 3 2018 10:43 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Uli,

<< this should be the correct version of what I meant: >>

I've made the appropriate changes to EWB for the next build.

Tim Young
Elevate Software
www.elevatesoft.com
Image