DEV Community

Peter + AI
Peter + AI

Posted on

Mastering Uniface Help System: A Developer's Guide to the help Statement πŸ“š

Working with legacy enterprise applications can be challenging, especially when it comes to providing user assistance. If you're developing with Uniface, understanding the help statement is crucial for creating user-friendly applications. This comprehensive guide will walk you through everything you need to know about implementing help systems in Uniface 10.4. πŸš€

This article is based on the official Uniface Documentation 10.4 and was compiled with assistance from AI to ensure accuracy and completeness.

What is the Uniface help Statement? πŸ€”

The help statement in Uniface is a versatile command that displays help information in your applications. It can either show custom Uniface help messages or integrate with your system's native help system. Think of it as your gateway to providing contextual assistance to users. ✨

Syntax Overview πŸ“

The help statement comes in several flavors:

help (/id | /topic | /keyword) Parameters {/noborder}
help {/noborder} HelpMessage {, VertPos,HorizPos {, VertSize,HorizSize}}
help/id Topic, ChmFile
help/topic Topic {,LogicalName}
help/keyword Keyword {,LogicalName}
Enter fullscreen mode Exit fullscreen mode

Available Qualifiers 🎯

Qualifier Description
/id Retrieves help topics from CHM files using numeric context IDs
/topic Displays help topics, indexes, or table of contents from native help
/keyword Shows help for specific keywords from WinHelp files (obsolete system)
/noborder Displays help form without borders in character mode

Key Parameters Explained πŸ”§

  • Topic: String identifier for help topics. Empty string ("") shows index/table of contents
  • LogicalName: Help file location from initialization file. Defaults to "DEFAULT" if omitted
  • Keyword: Maps to specific help topics. Empty or unfound keywords trigger error messages
  • HelpMessage: Custom help text, often using the $text function
  • Position/Size parameters: Control help window dimensions in character cells

Return Values and Error Handling 🎭

The help statement returns various status codes through $status:

Value Meaning
1 Help form exited with ^ACCEPT
0 Native help successfully started
-1 Help form USYS:USYSTXT.frm not found
-3 Unable to start native help
-4 Platform doesn't support native help
-7 Requested topic or keyword not found

Practical Examples πŸ’‘

Example 1: Calling Native Help

trigger help
    help/topic " ", "myhelp"
    if ($status < 0)
        message "Unable to show help index: %%$status"
    endif
end ; end trigger
Enter fullscreen mode Exit fullscreen mode

Example 2: Displaying Custom Help Messages

trigger help
    help/noborder $text(HELPTEXT), 3,4,7,23
end; help
Enter fullscreen mode Exit fullscreen mode

Windows-Specific Integration πŸ–₯️

For Windows applications, you can integrate with:

  • Microsoft Compressed HTML Help (.chm): Use help/id to launch HTML Help Viewer
  • WinHelp format (.hlp): Use help/topic and help/keyword for legacy support

Best Practices 🌟

  • Always implement proper error handling using $status return values
  • Use logical names in initialization files for flexible help file management
  • Consider platform compatibility when choosing help formats
  • Test help functionality across different environments (GUI vs. character mode)
  • Provide fallback mechanisms for unsupported platforms

Common Error Scenarios 🚨

Error Code Constant Solution
-350 UHLPERR_STARTUP Check if USYS:USYSTXT.frm exists and is correct
-351 UHLPERR_PLATFORM Implement alternative help display method
-352 UHLPERR_LOGICAL_NAME Verify logical name mapping in initialization file
-353 UHLPERR_TOPIC Check if help topic or keyword exists

Conclusion πŸŽ‰

The Uniface help statement is a powerful tool for creating comprehensive help systems in your applications. Whether you're working with modern CHM files or legacy WinHelp formats, understanding its various qualifiers and parameters will help you provide better user experiences. Remember to always implement proper error handling and consider platform-specific requirements when designing your help system.

Happy coding! πŸš€

Top comments (0)