Tip #3 : Customize the IDE: add our palettes

The IDE of Uniface 10 is highly customizable. Out of the box, Uniface gives you a default configuration similar to that of earlier Uniface versions. It is entirely compatible. Nothing wrong with that, of course. But the IDE offers much more than the default.

Take the widget templates you can use. In Uniface that list is called a palette. You can find it at the far left of the structure editor. There is one for each compont type. The default palettes contain all possible widgets.  I would advise you to customize them to your needs.

Why customize?

First, the default list contains all possible widgets. Increase clarity by removing widgets you don’t use.

Secondly, you can add your own widgets. For example, I use a palette with all kinds of more or less functional widgets, not just an editbox, but with a specific function. For example email address, IBAN and VAT. Including the desired layout and behavior.

Thirdly, you can choose multiple palettes per editor. So you can distribute the widgets over multiple palettes to create even more overview. For instance one for all buttons you use and in another palette the input widgets.

Of course the true 4GL developer, as we all are, will use the model as much as possible, but there are situations where you need to step outside the model. Even in those cases, Uniface is effective and helpful.

How to customize a palette?

The palettes are normally hidden in the IDE. That is, the IDE shows an instance of the palettes, but the definition is normally hidden. To change the palette definitions, you must set the logical “allow_browse_templates” to 1 in the assignment file. This logical is normally set to 0. I would like to advise you to set the setting back to 0 after adjusting the palettes.

[LOGICALS]
allow_browse_templates = 1

Once you (re)start the IDE, after you have modified the logical, you can open and modify the palettes. The palette is implemented in the IDE as a component.

In the ubar, you can search for “cpt:PAL” to see all the components that have ‘PAL’ in their name of decription.

The Uniface IDE showing the palettes in the ubar
Figure 1: Smart suggestions show all components with ‘PAL’ in their name

 

In the figure see my palette “PETER_FRM_PAL”. To create it, I first opened the component “UPALETTE_FRM”, duplicated it and renamed it. Then I made my adjustments in this duplicate.

 

  • Advice 1: You can start from scratch with a new component, but I usually choose to use a default of Uniface as a starting point.
  • Advice 2: Never change the defaults of Uniface, because you could lose your changes during an update of Uniface. Duplicate a palette from Uniface and edit this copy.

 

As long as I’m still working on my own version of the palette, I have the original palette from Uniface still active in the IDE. So on the left side in the resource browser is the palette “UPALETTE_FRM”, while I work on my own version.

For example, to create an email address widget, I draw an edit box on my component. This one I call “EMAILADDRESS.” I specify a meaningful description and give all properties the desired properties. Business as usual, isn’t it.

Then I can choose to put the behavior in the template as well. Of course, this is very much dependent on the chosen workflow, coding guidelines and used framework within your project. But to give you an idea you could use the code below:

 

 


trigger valuechanged
    if  (@$fieldname != $syntax("&*%@*.*"))
        message "Wrong syntax. Please type a valid email address"
    endif (0)

end

 

Once you have compiled the component with the palette definition, you can use it immediately in the IDE. Just select it as the palette to use in the resource browser.

The Uniface IDE with my own palette selected and in use
Figure 2: The FRM editor uses my own palette with functional widget templates

Use it in your development environment

The palette is an ordinary component. The difference being that your “ordinary” components are part of your application. The palettes become part of the IDE. You don’t have to deliver the palettes you create to your client, but you do have to distribute them to your fellow developers. And don’t forget to include them in your version control!

Do you want to use your palette as default in the IDE? Then modify the assignment file. Uniface has defined a whole series of logicals that determine which palette per component type is the default. For example, if I want to use my palette definition on every FRM component, I modify:

[LOGICALS]
ComponentEditor_DefineFrames_ResourceBrowser_DefaultPalette_FRM     = cpt:PETER_FRM_PAL

Don’t forget to set the logical allow_browse_templates back to 0 once you’re done.

[LOGICALS]
allow_browse_templates = 1

 

Now you have a customized IDE.

 

And now I wonder, how does your IDE look and feel? How did you modify it? Just let me know!

Share this post

Share on facebook
Share on twitter
Share on linkedin
Category of this post

Comments on this post

Leave a Reply

You want to stay up to date with our Uniface newsletter?

It looks like we have something in common. 

We both like Uniface. 

We share our thoughts about Uniface in our blogs and podcasts. We love to share our knowledge in open source projects. 

We can imagine you are too busy to keep visiting our website to see if there is something new. Subscribe to your newsletter and we will sent you a message once there is something new. 

Maximum once every month, you can unsubscribe every moment and it’s free. 

Subscribe now

It looks like we have something in common. 

We both like Uniface. 

We share our thoughts about Uniface in our blogs and podcasts. We love to share our knowledge in open source projects. 

We can imagine you are too busy to keep visiting our website to see if there is something new. Subscribe to your newsletter and we will sent you a message once there is something new. 

Maximum once every month, you can unsubscribe every moment and it’s free. 

This website uses cookies to ensure you get the best experience on our website.