DEV Community

Peter + AI
Peter + AI

Posted on

Uniface colorbox Command: A Complete Guide to Color Dialog Integration ๐ŸŽจ

This article was created with the assistance of AI and is based on the official Uniface Documentation 10.4.

What is the colorbox Command? ๐Ÿค”

The colorbox command in Uniface is a powerful utility that launches the Microsoft Windows Color dialog box directly from your application. Whether you're building desktop applications that need color selection functionality, this command provides a seamless integration with the native Windows color picker.

Syntax Overview ๐Ÿ“

colorbox {/hex | /rgb} {/full} {"Color"} 
Enter fullscreen mode Exit fullscreen mode

The beauty of this command lies in its simplicity and flexibility. Let's break down each component:

Qualifiers Explained ๐Ÿ”ง

Qualifier Purpose Result
/hex Hexadecimal output Returns color as hex string (e.g., "#FF0000")
/rgb RGB output Returns color as RGB values (e.g., "255,0,0")
/full Extended dialog Shows full color picker with custom colors

Practical Examples ๐Ÿ’ก

Basic Color Selection

# Simple hex color picker starting with green colorbox /hex "#00FF00" # RGB color picker with green preset colorbox /rgb "0,128,0" # Full-featured color dialog colorbox /hex /full "#00FF00" 
Enter fullscreen mode Exit fullscreen mode

Dialog Variations ๐ŸŽ›๏ธ

Without the /full switch, you get a compact color dialog perfect for quick color selection. With /full, users access the complete Windows color picker including custom color creation capabilities.

Return Values & Error Handling โšก

The command provides clear feedback through $result and $status:

  • $status = 0: User clicked OK โœ…
  • $status < 0: User cancelled or closed dialog โŒ
  • $result: Contains the selected color in your chosen format

Smart Color Memory ๐Ÿง 

One of the most developer-friendly features is the automatic color memory. The dialog remembers the last selected color throughout the application session, making it intuitive for users who work with consistent color schemes.

Integration Tips ๐Ÿš€

  • Use in Form components for optimal performance
  • Consider accessibility - the command includes testing support for screen readers
  • Choose between hex and RGB based on your application's color handling needs
  • Leverage the color memory feature for better user experience

Conclusion ๐ŸŽฏ

The colorbox command exemplifies Uniface's philosophy of providing powerful, yet simple tools for desktop application development. Whether you're building a design tool, customization interface, or any application requiring color selection, this command offers native Windows integration with minimal code.

Ready to add some color to your Uniface applications? Give colorbox a try in your next project! ๐ŸŒˆ


Want to learn more about Uniface development? Follow me for more insights into this powerful RAD platform!

Top comments (0)