Jump to content

Resizing TUniContainerPanel height to fit word wrapped text in TUnilabel


Max3073

Recommended Posts

Hi,

I have some panels (TUniContainerPanels) stacked one on the other (Align := alTop). Inside these panels I have a TUnilabel (and some other components). The UniLabel is aligned left and has a fixed width. Of course the label caption may vary and eventually it will be wrapped. Here comes my problem. when the text is wrapped I would like to resize the heigth of the container so that the text can be fully visible. In general i would like to set the height of the parent panel to the exact height of the wrapped text. Is there a way to do it?

Link to comment
Share on other sites

13 hours ago, Abaksoft said:

Hello,

1. Switch all to client side alignment (form, frame, ...)

2. unicontainer layout Height : auto.

you can see :

http://forums.unigui.com/index.php?/topic/15007-mobile-centering-text/

 

I'm afraid this won't work (at least this is what i think).
My final goal is to simulate what you could do in a delphi desktop application with the TVirtualStringTree component: a tree view where each line can contain different components and different editors. I'm a attaching a simple picture since I don't know if my description is understandable.
I also need components on a "line" to be vertically centered and the "line" to have the right size to show the content (each line can have different height). As you might see from the test project attached in the other message, I thought that a simple approach would be to create a frame containing components to simulate a single treeview item (or record). But I have no idea how to resize the height (neighter how to center everything vertically).
I'm stuck :(

TreeView.jpg

Link to comment
Share on other sites

10 hours ago, Sherzod said:

Hello,

This post may help you:

 

Great!!!  Thank you! it looks like it's exactly what I'm looking for... But I switched to TUniFrame (instead og TUniContainerPanel) and it's not working when I'm trying to resize the height 

this is the code I'm using:

  UniMemo1.ClientEvents.ExtEvents.Values['resize']:=
           'function resize(sender, width, height, oldWidth, oldHeight, eOpts) {'+
              Name+'.form.setHeight((height+80));'+
           '}';

("Name" is the name of the Frame assigned at runtime after creation)

Sorry I have much to learn about UniGui

:(




 

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...