dinsdag 6 augustus 2013

An Office-style File menu in Uniface

Have you ever looked closely at the File menu of the MS-Office product? When you look closely you will see that these menus are graphically much more complex than you would think. After some experimenting I managed to replicate it in Uniface 9.6.

You need some Command Buttons and a TabEx widget. In the download you find the logical widget definitions and the images that I used. And in the Uniface form so you can see how it works.

I am no legal expert but you may want to modify this sample before you use it in a production application because you don't want to infringe Microsoft's copyright.



maandag 1 juli 2013

Blend in your HTML Widget

Just a little trick to make an HTML widget blend in better with the rest of your application.


Two aspects:

  1. Get the background color that is used in your application
    I retrieve the color from the .ini file. You could also use $windowproperties to get the backcolor of the window.
  2. Set the background color of the HTML using JavaScript.
    The use of the eval function means that you do not have to include a JavaScript function in your HTML, meaning you can even use this for external websites.


; Set background color of the HTML widget to 
; the color specified in the backcolor property of 
; the window logical widget in 
; the [application] section of the .ini file
call lpGetSetting("application\window","backcolor",vColor)
if (vColor <> "")
   show
   $fieldhandle("TEXT.DUMMY")->$widgetoperation( "JS:eval(%%"document.body.style.backgroundColor = '%%vColor%%%';%%")")
endif
end


entry lpGetSetting
params
   string pSetting : IN
   string pTopic : IN
   string pValue : OUT
endparams
variables
   string vTopics
endvariables

   vTopics = $setting("", pSetting, "INIDATA")
   vTopics = vTopics[$scan(vTopics,"(")+1]
   vTopics = vTopics[1:$rscan(vTopics,")")-1]
   vTopics = $replace(vTopics, 1, ";", "·;", -1)
   getitem/id pValue, vTopics, pTopic

end

maandag 10 juni 2013

A Facebook Like button in Uniface

This is really simple:

  1. Determine the URL of what you want your Like button to like.
    If it is a posting you have to hover over the timestamp to see the URL.

  2. Paint an HTML Widget on your Uniface Form.

  3. Assing the following string to the widget:
    "&http://www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2FUnisocialCommunity%2Fposts%2F382515988535596&send=false&layout=button_count&width=450&show_faces=true&font&colorscheme=light&action=like&height=21&appId=222806551068648"

  4. Now the Like button goes to one of my postings.
    To change that replace the URL in the href parameter with your own URL. Use URL encoding, %2F is a foward slash. So you have to replace this bit:
    https%3A%2F%2Fwww.facebook.com%2FUnisocialCommunity%2Fposts%2F382515988535596

  5. Compile and run!
    (If you are not logged on to Facebook yet, a login dialog will appear after you have pressed to button.  Please follow the instructions in the dialog.)

Needless to say that this is just as easy in a Uniface Web application...

maandag 1 april 2013

Recursive Indirection

"Recursive indirection". That sounds pretty impressive but I guess it does not mean much to you without some explanation. Here it comes:

You all know how to assign a value to a variable  in Uniface:
vValue = "Hello world"

And you also know how to assign to value of a field to a variable:
WELCOMETEXT.DUMMY = "Hello world"
vValue = WELCOMETEXT.DUMMY

Most of you also know that you can use indirection.
With indirection you have a field that contains the name of another field., and you use this to assign the value of that field to a variable:

WELCOMETEXT.DUMMY = "Hello world"
WELCOMEFIELD.DUMMY = "WELCOMETEXT.DUMMY"
vValue = @WELCOMEFIELD.DUMMY

Not many people know that (in recent Uniface versions) you can do this recursively:
WELCOMETEXT.DUMMY = "Hello world"
WELCOMEFIELD.DUMMY = "WELCOMETEXT.DUMMY"
WHATFIELD.DUMMY = "WELCOMEFIELD.DUMMY"
vValue = @@WHATFIELD.DUMMY

You probably do not need this often, but it can be valuable in complex user interfaces or maybe a software package that is highly configurable. Don't forget to put in some comments when you use this: it is powerful but it does not make your code easy to understand for your fellow developers!





maandag 11 maart 2013

Sneak preview

In this picture you see some new stuff that is planned (!) for release in Uniface 9.6.02.

Can you see what the differences are without looking at the answers below?


maandag 4 maart 2013

I love the HTML Widget

Back in August 2010 I made a couple of samples to show that you could use web functionality from Uniface client/server applications. It worked, wasn't too difficult, and you could make a lot of nice things with it. But it was a bit of a hassle having to use an OCX container to get a browser window. You can have a look at the old blog entry if you want. 

In Uniface 9.6 creating stuff like this is even much easier. Putting a Google map in your Uniface client/server application is so simple now. A static map is really just supplying a URL to the HTML widget, and a dynamic map with zoom and even Street View is not much more difficult. Have a look at the Sample that I have put on www.uniface.info

Get your kicks with Uniface 9.6


woensdag 16 januari 2013

User Experience and Development Productivity

After reading several posts on User Experience on www.uniface.info I could not resist writing down my opinion on User Experience and Productivity in Uniface.

Read it here

donderdag 10 januari 2013

New sample in Japanese

It was very strange for me to see my work suddenly in a Japanese version. The command button sample on www.uniface.info is now also available in that language.

Thanks to:
  • Kazuyoshi - Translating
  • Junya - Proof reading
  • Michael - Artwork

Click the picture to go to the sample: