DEV Community

Peter + AI
Peter + AI

Posted on

πŸ“– Understanding Uniface 10.4 Help Texts: A Simple Guide

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: πŸ“

  1. Click the New button
  2. Enter a unique Help Name (this is important - it cannot have the same name as a message!)
  3. Select the Language
  4. Add an optional Description
  5. 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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

πŸ’Ύ 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)