β οΈ Note: This blog post was created with AI assistance to help explain Uniface 10.4 concepts in simple terms.
π What Are Global Objects?
Global objects in Uniface are reusable pieces of code and resources that you can use across your entire application. Think of them as shared tools in a toolbox that any part of your application can access. The most common types are:
- π§ Global ProcScripts - Reusable code functions
- π¬ Messages - Text strings for user interfaces
- π¨ Glyphs - Icons and images
- π Translation Tables - Language translations
Instead of writing the same code multiple times, you create it once as a global object and reference it wherever needed. This makes your application easier to maintain and update! β¨
ποΈ Creating Global Objects: Step by Step
Step 1: Open the Right Editor π±οΈ
In the Uniface IDE, navigate to More Editors and select the type of global object you want to create. You'll find these options under the Library heading.
Step 2: Choose Your Library π
When the Open Library dialog appears, you have two choices:
- Create a new library if you're starting fresh
- Select an existing library if you want to add to what's already there
Pro tip: Keep related objects together in the same library for better organization! π
Step 3: Create or Edit Your Object βοΈ
Now you're ready to work:
- Click New to create a brand new object
- Select an existing object from the list to update it
Step 4: Set Properties βοΈ
Configure your object's properties according to your needs. Each object type has different properties you can set.
Quick help: Press F1 at any time to see detailed information about the available properties!
Step 5: Compile (If Needed) π¨
Some objects need compilation before they can be used. If you see a compile icon, click it or go to File > Compile.
Step 6: Save Your Work πΎ
You have two saving options:
- Choose File > Save to save and continue working
- Click OK to compile, save, and close the editor in one step
π‘ Practical Example: Creating a Global Message
Let's say you want to create a welcome message that appears in multiple places in your application:
- Open More Editors > Messages
- Select or create a library called "AppMessages"
- Click New
- Set the message ID to "WELCOME_MSG"
- Set the text to "Welcome to our application!"
- Click OK to save
Now you can reference "WELCOME_MSG" anywhere in your code, and if you need to change the welcome text later, you only update it in one place! π―
ποΈ Deleting Global Objects
Need to remove an object? It's simple:
- Select the object you want to delete
- Click the Delete button, or
- Choose Edit > Delete from the menu
β οΈ Warning: Make sure no other parts of your application are using this object before you delete it!
π Best Practices
- π Use descriptive names - Make object IDs clear and meaningful
- ποΈ Organize by category - Group related objects in the same library
- π Document your objects - Add comments to explain what each object does
- π Reuse before recreating - Check if a similar object already exists
- π§ͺ Test after changes - Always test your application after modifying global objects
π― Key Takeaways
Global objects are a powerful feature in Uniface 10.4 that help you:
- β Write code once, use it everywhere
- β Keep your application organized and maintainable
- β Make updates quickly and efficiently
- β Reduce code duplication
By mastering global objects, you'll make your Uniface development workflow much more efficient! π
Happy coding! π»β¨
Top comments (0)