XbW: An Introduction to the "adder" Demo


The "adder" example shows how easy it is to build a user interface on top af a standard C program. The user interface is being created automatically. Your modifications to it will be done within an extra window. All these sources are located in /xw/applications/adder/ .

The following files are written by the user:

adder.c
The program.
addermfx.h
The header file for connection to XbW.
myadder.mta
The user specific additions to the automatically created user interface.
The following picture shows the example; it is a simple calculator. The Idea is to create a standard "C" program adder.c and give it a user interface that is created by xbw. The program can add or subtract two values that are entered via an ascii file. This file is created by xbw, after the user has entered his data into the user interface.

The ADDER Demo

The demo files are connected in the following fashion: The MFI files and XbW

The example can be started manually by just typing:

     cd /xw/applications/adder
     xbw adder.c

You may exit XbW at any time by pressing F10. If you want to add two numbers:

  1. click field "Cmd" and enter a single "A" which means "ADD".
  2. click the Fields "A" and "B" and enter integer values.
  3. to start the program adder now, just click on "Start Program adder". A moment later you will see the result in the "SUM" Field. The "Display" field will show that the value in "SUM" is OK to be displayed.

Personal Additions

The adder example was created automatically out of addermfx.h. You will want to have a more realistic version of a calculator. So just type
   @myadder();
while the mouse cursor is in the XbW window. You will get a commandline at the bottom of the XbW window, where you may modify the command before presing return. Within an instant, your personal calculator will appear. It is based upon the automatically created user interface; but instead of modifying something that was created by a computer, you just have added your own personal window. This is one of the ideas of XbW: you get a large user interface within seconds and than add your modifications within your own window. So, if you change the underlying program (and its data structures), you do not necessarily need to reconstruct your personal additions to the automatically created user interface. After the personal window has been loaded, the example looks like this:

The personal window

The new window and its objects lay on top of everything that was automatically created. Now, if you have pressed the "+" button, the window will look like this:

The personal window

The "Sum" field now gets displayed because the program adder has returned a "1" in the "Display" Variable. You should have a look at the files addermfx.h and adder.c at this time. The file myadder.mta shows ats its end, how the "Display" Variable has been linked to the display status of the "Sum" field. If you press "C", the Sum field will get cleared again. The same can be done by selecting the automatically generated window and entering a "0" into the Display Field:

The personal window

Because during generation, XbW did not know that you wanted to use Display in conjunction with the "Sum" field. So in this window, nothing happens. But if you change back to your "personal" window, the "Sum" field is now cleared (see above).


XbW: "X without Bells and Whistles" created by:
Hendrik Maroske, Höhenweg 32, 78315 Radolfzell Germany, Tel.0049-7732-12783
””