Page 1 of 1

Carriage Return in a Label Field

Posted: Thu Jun 02, 2016 3:37 am
by billcross
Is there a way to insert a carriage return in a label field so it appears like

Part 1
Part 2

Instead of Part 1 Part 2

Re: Carriage Return in a Label Field

Posted: Thu Jun 02, 2016 8:27 am
by Stewart Marshall
You can embed a carriage return as follows.

This can only be done at runtime at the moment.

Code: Select all

Begin_Com Role(*EXTENDS #PRIM_WEB) Theme(#SYS_THEME<2015DeepOrange>)

Define_Com Class(#PRIM_LABL) Name(#Label1) Caption('Click Me') Displayposition(1) Ellipses(Word) Height(34) Left(112) Parent(#COM_OWNER) Tabposition(1) Tabstop(False) Top(24) Verticalalignment(Center) Width(169) Alignment(Center) Themedrawstyle('MediumTitle') Margintop(10) Marginbottom(10)

Evtroutine Handling(#Label1.Click)

#Label1 += (10).AsUnicodeString + "Now with another line"

Endroutine

End_Com

Re: Carriage Return in a Label Field

Posted: Fri Jun 03, 2016 8:26 pm
by billcross
What about when the label is part of a list. The solution you describe does not appear to work.

Also, how do you make a label field in a list wrap ?

Re: Carriage Return in a Label Field

Posted: Tue Jun 07, 2016 11:10 am
by Stewart Marshall
String columns in a list may look like a label, but they are in fact an edit, which means the carriage return will be ignored.

However, you can create a reusable part, implementing the Prim_list.iListCellDesign interface, and use this as a column in the list. As it's a reusable part, you can fill it with a label. This will show the carriage return properly.

Today, you'll have to set the row height manually. However, SP1 will introduce content sizing. This is a set of layout features that allow controls to resize to the their content e.g. the text in a label. This will allow you to add a row to a list and have the row change height.

Re: Carriage Return in a Label Field

Posted: Thu May 02, 2024 1:43 am
by lansacoder
Thanks for the tip on adding a carriage return with => (10).AsUnicodeString

This helped me generate a SasToken in LANSA vs. JAVA.