Web Page - Fit the size of the Multi-line edit box to the text

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
Taku Izumi
Posts: 63
Joined: Thu Dec 15, 2016 2:03 pm

Web Page - Fit the size of the Multi-line edit box to the text

Post by Taku Izumi »

Hi,

To fit the height and width of the Multi-line edit box to the length of the text, I tried to use the Content unit layout.
But it does not change the size of the Multi-line edit box, I can not get the result I expected.

How should I define a layout for it?

This is my test case.

Code: Select all


Begin_Com Role(*EXTENDS #PRIM_WEB) Layoutmanager(#Layout1) Height(545) Width(897)
Define_Com Class(#PRIM_TBLO) Name(#Layout1)
Define_Com Class(#PRIM_TBLO.Column) Name(#Column1) Displayposition(1) Parent(#Layout1)
Define_Com Class(#PRIM_TBLO.Column) Name(#Column2) Displayposition(2) Parent(#Layout1) Units(Content) Minwidth(300) Width(300)
Define_Com Class(#PRIM_TBLO.Column) Name(#Column4) Displayposition(3) Parent(#Layout1)
Define_Com Class(#PRIM_TBLO.Row) Name(#Row1) Displayposition(1) Parent(#Layout1)
Define_Com Class(#PRIM_TBLO.Row) Name(#Row2) Displayposition(2) Parent(#Layout1) Units(Content) Minheight(30) Height(30)
Define_Com Class(#PRIM_TBLO.Row) Name(#Row3) Displayposition(3) Parent(#Layout1)
Define_Com Class(#PRIM_TBLO.Item) Name(#Text1Item1) Manage(#Text1) Parent(#Layout1) Row(#Row2) Sizing(ContentWidthAndHeight) Column(#Column2) Alignment(TopLeft)
Define_Com Class(#PRIM_TEXT) Name(#Text1) Displayposition(1) Left(299) Parent(#COM_OWNER) Tabposition(1) Top(258) Width(300) Height(30)

Evtroutine Handling(#Com_owner.Initialize)
Begin_Loop To(5)
#Text1.Text += 'aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ' + (10).AsUnicodeString
End_Loop
Endroutine
End_Com

Regards,
Taku
HamadSheikh
Posts: 27
Joined: Fri Mar 18, 2016 3:49 am
Location: USA
Contact:

Re: Web Page - Fit the size of the Multi-line edit box to the text

Post by HamadSheikh »

There must be multiple ways of doing this. Here is one possible way:

Begin_Com Role(*EXTENDS #PRIM_WEB) Layoutmanager(#Layout1) Height(545) Width(897)
Define_Com Class(#PRIM_TBLO) Name(#Layout1)
Define_Com Class(#PRIM_TBLO.Column) Name(#Column1) Displayposition(1) Parent(#Layout1)
Define_Com Class(#PRIM_TBLO.Column) Name(#Column2) Displayposition(2) Parent(#Layout1) Units(Content) Minwidth(300) Width(300)
Define_Com Class(#PRIM_TBLO.Column) Name(#Column4) Displayposition(3) Parent(#Layout1)
Define_Com Class(#PRIM_TBLO.Row) Name(#Row1) Displayposition(1) Parent(#Layout1)
Define_Com Class(#PRIM_TBLO.Row) Name(#Row2) Displayposition(2) Parent(#Layout1) Units(Content) Minheight(30) Height(30)
Define_Com Class(#PRIM_TBLO.Row) Name(#Row3) Displayposition(3) Parent(#Layout1)
Define_Com Class(#PRIM_TBLO.Item) Name(#Text1Item1) Manage(#Text1) Parent(#Layout1) Row(#Row2) Sizing(ContentWidthAndHeight) Column(#Column2) Alignment(TopLeft)
Define_Com Class(#PRIM_TEXT) Name(#Text1) Displayposition(1) Left(299) Parent(#COM_OWNER) Tabposition(1) Top(258) Width(300) Height(30)

Evtroutine Handling(#Com_owner.Initialize)
Begin_Loop To(5)
#Text1.Text += 'aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ' + (10).AsUnicodeString
#std_num := #Text1.text.CurChars * 1.5
If Cond(#Text1.width < #STD_NUM)
#Text1.Width := #STD_NUM
Endif
#Text1.Height += 15
End_Loop
Endroutine
End_Com
Taku Izumi
Posts: 63
Joined: Thu Dec 15, 2016 2:03 pm

Re: Web Page - Fit the size of the Multi-line edit box to the text

Post by Taku Izumi »

That was what I expected.

Thanks,
Taku
Post Reply