The POWER-KI programming language for IA

Develop solutions from Factory Automation to Web Application

©®2014 XPLAB - Research in Automation
© 2014 APX - Advanced Programming Exploitation
Brescia - Italy

Hello World !

The ubiquitous "hello World!"

As usual, the program does not do anything useful, but from it you can learn something about GUI: how to show, how to fill a gui field.

2014-08-10 12:47:05

In POWER-KI you have may ways to write an "Hello World!", the simplest is to create an assembly (.pka) and use one these two functions in the CODE of the MAIN EXO:
chatput("HELLO WORLD!);
consout("HELLO WORLD!),
But in this example we want to show you an HW a little more complete, so that you can appreciate some of the PWK features.

The program has a very simple behavior: it starts, displays the GUI, writes a first message, waits two seconds, writes "Hello WORLD!" and goes into an infinite loop from which exits when the GUI sets a global variable.
Program flow
From the menu of the WorkBench, create the package which we call "DEMO_HelloWord", to it we will add: to the resources a background image chosen from among those present in the directory PWK-PRG \ RES, to the UserInterface a GUI and to the assembly the executable.
Create the Package
In the FORM element of the GUI we will insert an image, which will be used to display the background, and a LABEL with a FONT element. In LIVE mode we will give the right position and dimension to the object.
Create the GUI
In the assembly we add a GUI item that connect the GUI to it. In the CLOSE case of the TRIG we set the Global stop@main symbol to 1;
Assembly: the GUI item
In the Main, we set the stop symbol to 0 and we send the SHOW message to the GUI, so that the user can see it. In the TEXT element of the label we put the notice to wait. The sleep function is invoked, on its end we change the message. The program flow goes now in a while loop, where every 200ms is cecked the value of stop symbol, on 1 the loop is terminated as well as the program.
Assembly: the MAIN EXO


download HW


©2010-2016 XPLAB - Research in Automation - Brescia - ITALY - [IT03259580177] This Website is a XAILS project Written and Directed by POWER-KI - All right reserved,