CALCULATOR DEMO


 
home download demos platforms restrictions help

This is a fully functional virtual calculator built using XEBOT (an IPAD-Pro sub app). The following pictures are screen shots showing the drawing from which the calculator was generated and some of the edit windows used to define the properties of the calculator controls (digit keys, operation keys, function source code, object context). Lastly the full source code cut from the exported drawing is also given.
scrn0000.gif 21k Drawing of a calculator
scrn0001.gif 7k Actual working calculator generated from drawing
scrn0002.gif 20k Context of digit '7' key on calculator showing the digit value of the key
scrn0003.gif 21k The 'digit_pressed' function invoked when any of the digit keys on the calculator are pressed

The actual digit value is taken from the context of the key (see scrn0002.gif above)

scrn0004.gif 21k Context of operator '+' key on calculator showing the operator type of the key
scrn0005.gif 23k The 'op_pressed' function invoked when any of the arithmetic operator keys on the calculator are pressed

The actual operation is taken from the context of the key (see scrn0004.gif above)

scrn0006.gif 20k The 'do_add' function used to perform the addition operation on two numbers. This function is called indirectly when the '=' key or any of the arithmetic operator keys '+', '-', 'x' or '/' are pressed. It is only called when the previous arithmetic operator keys pressed was the '+' key.
scrn0007.gif 23k The 'equal_pressed' function invoked when the '=' key on the calculator is pressed. This function combines two numbers and an operation to give a result. The operation is setup when one of the arithmetic operator keys '+', '-', 'x' or '/' is pressed.

Note the C style indirect function call used in combination with the string name of the function used to call one of the functions 'do_add', 'do_sub', 'do_mult', 'do_div' and 'do_null'
 

scrn0008.gif 19k The settings of the digit '7' key on the calculator. 

This is how the control properties of the key are setup when the calculator is designed.

Note:

  • the '7' in the caption setting gives the '7' as the key legend
  • the 'CALCULATOR::digit_pressed' in the pressed_function_name setting tells the system what to do when the key is pressed (see scrn0003.gif above)
scrn0010.gif 20k The settings of the '+' operation key on the calculator. 

This is how the control properties of the key are setup when the calculator is designed.

Note:

  • the '+' in the caption setting gives the '+' as the key legend
  • the 'CALCULATOR::op_pressed' in the pressed_function_name setting tells the system what to do when the key is pressed (see scrn0005.gif above)
calc_proc.txt 2k This source code has been cut from the exported calculator drawing. It is complete (with the exception of the context 'digit' and 'op_type' data described above) and is entirely written in the IPAD-Pro core interface API called XPE. 

The API is designed to allow externally written C, C++ and Assembler code to be quickly and easily integrated into an IPAD-Pro sub app by allowing the programmer to collect and pre-process any required data from the GUI or core and present it to his/her external functions in the manner which is most convenient and natural to the sub app (i.e. the programmer is not forced to provide hundreds of intermediate functions and buffers to import data into the sub app for subsequent processing). 

As can be seen, the API is so powerful that in this case there was no need to call any external code.

Also note the complete lack of any kind of event message decoding. This is a good thing, since it lets the programmer get on with solving the problem rather than worrying about doing the GUI's job for it.


 
home download demos platforms restrictions help