Note: This blog post was created with AI assistance to help explain Uniface concepts in simple terms.
π What Are Global Objects?
In Uniface 10.4, global objects are reusable resources that your application can access from anywhere. Think of them as a shared toolbox that all parts of your application can use. These include messages, menus, glyphs (icons), panels, and ProcScripts (code modules).
π― How Uniface Finds What It Needs
When your application needs a global object, Uniface doesn't just look in one place. It follows a specific search order through different libraries until it finds what it needs. This is similar to how you might search for a book - first in your desk drawer, then on your bookshelf, and finally in the library.
π The Role of Language and Variation
Two important settings control where Uniface searches:
- $VARIATION: Specifies which library to use
- $LANGUAGE: Defines the language for language-specific objects
π The Fallback Mechanism
Here's the clever part: if Uniface can't find what you asked for, it doesn't just give up. It uses a fallback search strategy to find the closest match.
Example: Searching for a Message
Let's say you request a message in German (DEU language) from a custom library called MYAPP:
- π₯ First try: MYAPP library with DEU language
- π₯ Second try: USYS library (system default) with DEU language
- π₯ Third try: MYAPP library with USA language (English fallback)
- π Final try: USYS library with USA language
π Search Order for Language-Specific Objects
Objects like messages, menus, menu bars, and glyphs have language variations. Uniface searches in this order:
Priority | Library | Language | Objects Affected |
---|---|---|---|
1 | $VARIATION | $LANGUAGE | Messages, Menus, Menu bars, Glyphs |
2 | USYS | $LANGUAGE | Messages, Menus, Menu bars, Glyphs |
3 | $VARIATION | USA | Messages, Menus, Menu bars, Glyphs |
4 | USYS | USA | Messages, Menus, Menu bars, Glyphs |
5 | Component library | $LANGUAGE | Menus, Menu bars, Glyphs |
6 | Component library | USA | Menus, Menu bars, Glyphs |
π§ Search Order for Non-Language Objects
Objects without language variations follow different search patterns:
Global ProcScripts π»
When calling a global ProcScript without specifying the library:
- The component's library
- The application shell library
- The SYSTEM_LIBRARY
Example: If you call call MyProcedure
from a component in library SALES, Uniface first looks in SALES, then in your application shell, and finally in SYSTEM_LIBRARY.
Global Variables π¦
Global variables are searched in this order:
- SYSTEM_LIBRARY
- Application shell library
- Global ProcScript's library (if used within a ProcScript)
- Component library
Panels and Translation Tables π¨
These objects follow a simpler search pattern:
- $VARIATION library
- USYS library
π‘ Pro Tips
- Explicit Library Specification: You can force Uniface to look in a specific library by using the syntax
Library::ProcName
. For example:call MYLIB::SpecialProc
- Resource Server Delegation: When a client delegates searching to a resource server, it only looks in the first location - no fallback searching occurs
- Component Library Fallback: For glyphs and menu bars, if the normal search fails, Uniface will try again using the component library name as the variation
π Why This Matters
Understanding the search order helps you:
- β Organize your libraries efficiently
- β Create proper fallbacks for international applications
- β Debug when objects aren't being found
- β Optimize application performance by placing frequently-used objects in higher-priority libraries
π Summary
Uniface 10.4's search order system is like a smart filing system. It knows where to look first, has backup plans if something isn't found, and can handle multiple languages gracefully. By understanding this system, you can build more maintainable and international-ready applications.
The key takeaway: Uniface always starts with your specific request ($VARIATION and $LANGUAGE) and progressively falls back to more general options (USYS library and USA language) until it finds what it needs.
Happy coding! π
Top comments (0)