(Note: This blog post was crafted with the assistance of an AI to help explain the documentation.)
Hello everyone! π If you're working with the low-code platform Rocket Uniface, you're likely familiar with its scripting language, ProcScript. Today, we're diving into a simple but useful function: $underline. Let's break it down in easy terms!
What is the $underline Function? π€
In short, the $underline function is a built-in ProcScript tool that allows you to programmatically add an underline to a string of text. Its primary purpose is to change how text is displayed to the end-user.
The most important thing to know is that this visual effect only works in Form components and is specifically visible in a Unifield. It won't work in other widget types or when writing to a file, for example.
How Do You Use It?
The syntax is incredibly straightforward. You just wrap the text you want to underline with the function.
$underline(String)
The String parameter can be any of the following:
- A literal string (e.g., "Hello World")
- A variable holding a string value
- A field
- Another function that returns a string
A Simple Example π»
Let's imagine you have a Form component with a field named MY_UNIFIELD. You want to display some text in it with an underline. You would write the following ProcScript code:
MY_UNIFIELD = $underline("This text will be underlined")
When this code is executed, the user will see "This text will be underlined" displayed within the MY_UNIFIELD on the form. Itβs that simple!
A Key Thing to Remember π§
The $underline function only affects the display of the text. It does not change the actual data stored in the field.
In our example, even though the user sees an underlined string, the actual value stored inside MY_UNIFIELD is still just "This text will be underlined". The underline is a visual attribute.
If you ever need to remove these kinds of display attributes from a string to get back to the raw value, Uniface provides the $stripattributes function. It's the perfect companion to $underline!
Conclusion
And there you have it! The $underline function is a simple tool for adding emphasis to text in your Uniface forms. Just remember that it's for display purposes only and is limited to Unifields.
Happy coding! β¨
Top comments (0)