Jump to content

UniLabel txtHTML height


JDDEV

Recommended Posts

Hi all,

I have an uniLabel with AutoSize=True and textConversion=txtHTML

The default height is 23 and at runtime i put Caption:='Line1<br>Line2';

The height is still 23. I hoped 46 !

Does exist a function to get the height of a Html text ?

Thank you.

Link to comment
Share on other sites

The UniLabel has got an UniSimplePanel for parent.

The UniLabel is align on top to the UniSimplePanel.

At run time when i change UniLabel.Caption (with html tags), i would like to autosize UniSimplePanel synchronized with the new Unilabel content height.

Link to comment
Share on other sites

  • 1 year later...
On 2/12/2021 at 8:51 AM, JDDEV said:

The UniLabel has got an UniSimplePanel for parent.

The UniLabel is align on top to the UniSimplePanel.

At run time when i change UniLabel.Caption (with html tags), i would like to autosize UniSimplePanel synchronized with the new Unilabel content height.

No solution for that ?

 

Link to comment
Share on other sites

18 minutes ago, JDDEV said:

Yes on the server side.

You can try this approach:

1. UniLabel1.ClientEvents.ExtEvents ->

function resize(sender, width, height, oldWidth, oldHeight, eOpts)
{
    ajaxRequest(sender, '_change', {height: height})
}

2. UniLabel -> OnAjaxEvent

procedure TMainForm.UniLabel1AjaxEvent(Sender: TComponent; EventName: string;
  Params: TUniStrings);
begin
  if EventName = '_change' then
    (Sender as TUniLabel).Height := Params.Values['height'].ToInteger

end;

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...