Carriage Return in a Label Field

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
billcross
Posts: 30
Joined: Thu Apr 07, 2016 3:01 am

Carriage Return in a Label Field

Post by billcross » Thu Jun 02, 2016 3:37 am

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

User avatar
Stewart Marshall
Posts: 417
Joined: Thu Nov 05, 2015 5:25 pm

Re: Carriage Return in a Label Field

Post by Stewart Marshall » Thu Jun 02, 2016 8:27 am

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
Stewart Marshall

Independent IT Consultant
www.marshallfloyd.com.au

billcross
Posts: 30
Joined: Thu Apr 07, 2016 3:01 am

Re: Carriage Return in a Label Field

Post by billcross » Fri Jun 03, 2016 8:26 pm

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 ?

User avatar
Stewart Marshall
Posts: 417
Joined: Thu Nov 05, 2015 5:25 pm

Re: Carriage Return in a Label Field

Post by Stewart Marshall » Tue Jun 07, 2016 11:10 am

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

Independent IT Consultant
www.marshallfloyd.com.au

Post Reply