Showing posts with label image. Show all posts
Showing posts with label image. Show all posts

Saturday, 11 April 2015

Modernising the client application - icons in the menu

A lot of the Uniface development that I do these days is actually web development, which means I spend a lot of time with Javascript and JQuery, and less time with Uniface procscript.  However, we still have client applications as well, and they can look tired and dated, so anything we can do to make them look more modern, can be a big win!

This is a simple little trick that appeared in Uniface 9.6.  It's actually been around for a while in dropdown menus, first as an undocumented feature, and then documented in Uniface 9.5 - I wrote a blog post on this almost three years ago.  However, the same trick now works in menus.

You can reference images in the menu items like this...


You might not be able to read the image clearly, so the three menu items are...

  1. ^U_REM_SELECT·!Cu%t
  2. ^U_SAVE·!Copy
  3. ^U_INS_SELECT·!Paste

In this case, the image is at the start, with a gold-not (or gold-exclamation-mark) as a delimiter, and the menu item text after that.

This appears in the client application this this...



As you can see - lovely icons!  Please note that you would need these glyphs in your system for it to work, these are not provided as part of Uniface itself.  

You can include icons in one of two ways...

  • ^glyph - glyphs need to be compiled into UOBJ (always available and performs well).
  • @filename - images loaded from a fileserver (not always available and performs badly).

I would recommend the glyph option though, for performance and reliability.

You may also note that the percent character (%) can be used to denote which character should work when traversing the menu using the "Alt" key.  If you do not explicitly denote this, the first character will be used.

This is documented in the "Defining and Using Menus" section of the manuals, but can be hard to find unless you know what you're looking for!  It's worth reading this for more information though.

Summary:  It's possible to make the client application look a little more modern now by including icons in the menu bars.

Monday, 21 May 2012

Undocumented feature - images in dropdowns

As with any language, Uniface has some undocumented features.  Sometimes these are features that were developed but never fully supported for one reason or another, or sometimes the documentation was just forgotten along the way.  It can be risky using these features sometimes, as you never know if the functionality might be completed, changed or removed, and as it's not documented, you don't really have a leg to stand on.


Having said that, here is a nice but non-essential undocumented feature in Uniface - images in dropdowns.  The client application can be a little old-fashioned looking at times, although a lot can be done to improve this is the you have the time to fiddle with the settings.  Images in dropdowns do make it look a little more user-friendly though, I think.


It's easy to do in Uniface, but definitely "hacky".  When you set the valrep of the dropdown you might currently do it something like this...


$valrep(field) = "val1=Rep 1·;val2=Rep 2"


...which will display a dropdown list with two values in, "Rep 1" and "Rep 2".  If you want to add images, then you simply need to add the image at the beginning of each list item, but delimited with a gold-not instead of a gold-semi, like this...


$valrep(field) = "^img1·!val1=Rep 1·;^img2·!val2=Rep 2"


...and hey presto, images will appear.  These images can be in any of the following formats...

  • ^glyph - glyphs need to be compiled into UOBJ (always available and performs well).
  • @filename - images loaded from a fileserver (not always available and performs badly).
  • #fieldname - images loaded from a BLOB field in the database (always available and performs ok).
  • &url - images from the web (only works in server pages - not applicable for this).

Here is an example, just to prove it...


Summary: It is possible to display images in a dropdown in the client application, but it is undocumented and therefore unsupported.