This blog post was created with AI assistance to help developers understand Uniface 10.4 better. π€
π― What Are Help Texts?
Help texts in Uniface 10.4 are special text blocks that you can display in a help window to provide information to your users. Think of them as pop-up messages that give detailed explanations about features in your application. π‘
Important note: Help texts are provided mainly for backward compatibility. They are not recommended for modern applications, but understanding them is still valuable for maintaining older Uniface projects. β οΈ
π οΈ How to Create a Help Text
Step 1: Open the Help Text Editor
First, you need to open the editor where you can create and manage your help texts:
- Go to More Editors in your IDE
- Select Help Texts
- Choose or create a Message Library where you want to store the help texts
Step 2: Create Your Help Text
Once the editor is open, follow these steps to create a new help text: π
- Click the New button
- Enter a unique Help Name (this is important - it cannot have the same name as a message!)
- Select the Language
- Add an optional Description
- Type your help text in the Text field
Step 3: Set the Window Geometry (Optional)
You can control where and how big your help window appears on the screen: π
- Position: Set the Left and Top properties
- Size: Set the Width and Depth (Height) properties
π» How to Display a Help Text in Your Code
To show a help text in your application, you use ProcScript commands. The main commands are help and $text. Here's how they work together: π§
Basic Example
trigger help
$variation = myapp
$language = usa
help $text(HLP523)
end; help
Let's break this down: π
- $variation sets which library to use (in this case "myapp")
- $language sets the language (in this case "usa")
- $text(HLP523) retrieves the text from the help text named "HLP523"
- help command displays the text in a help window
Advanced Example with Window Positioning
trigger help
help/noborder $text(HELPTEXT),3,4,7,23
end; help
In this example:
- /noborder displays the window without a border (in character mode)
- The numbers 3,4,7,23 define the vertical position, horizontal position, vertical size, and horizontal size
Smart Field-Based Help
You can create dynamic help texts that work with field names. If you use a naming convention like Fieldname_HLP, you can use this code: π¨
trigger help
help $text("%%$fieldname%%%_HLP")
end; help
This automatically shows help for the current field. Pretty neat! β¨
π Important Things to Remember
Unique Names
Each help text must have a unique name. You cannot use the same name as a message because messages and help texts live in the same library. Think of it like having unique email addresses - no duplicates allowed! π§
Language and Library
Make sure the correct language and library are defined. You can set these in your ProcScript code or in the assignment file. If Uniface can't find your help text with the current settings, it will look for combinations with language "USA" and library "USYS" as a fallback. π
Checking if a Help Text Exists
Before trying to display a help text, you can check if it exists using the $textexist function. This helps avoid errors! π‘οΈ
if ($textexist("HLP523"))
help $text(HLP523)
endif
πΎ Saving and Deleting
After creating or modifying help texts:
- To save: Choose File β Save πΎ
- To delete: Select the help text and choose Edit β Delete Help Text ποΈ
π When to Use Help Texts
While help texts are still available in Uniface 10.4, they are mainly kept for backward compatibility with older applications. For modern applications, consider using: π
- Native help systems (like CHM files)
- Web-based documentation
- Tooltip messages
- Context-sensitive help integrated into your UI
π Quick Reference
Command | Purpose |
---|---|
help | Displays help information in a window |
$text() | Retrieves the text from a message or help text |
$textexist() | Checks if a message or help text exists |
$variation | Sets the library to use |
$language | Sets the language |
β Conclusion
Help texts in Uniface 10.4 provide a simple way to display information to users. While they're considered a legacy feature, understanding them is essential for maintaining existing Uniface applications. The combination of the help command and $text function gives you flexible control over when and how help information appears. π
Remember: keep your help names unique, set the correct language and library, and consider modern alternatives for new projects! Happy coding! π¨βπ»π©βπ»
Top comments (0)