The structure of the Basic-Code

A GtkBasic program internally runs two programs simultaneously.

The Gtk-mainloop displays the windows, and receives and emits events.
For example, if a button is clicked.

This Gtk-mainloop is invoked in the background in the beginning of the program, after
the file containing the windows-descriptions (project.glade) is loaded.


Then Basic continues to run then, in a "indefinite loop" (while 1)

In this loop, it listens to the events sent by the Gtk-mainloop.
So if a button is clicked, you now can check for its name, 
and branch to a corresponding function or sub.

You currently must add these subs manually to the existing code, simply use the examples 
as a template.

---------------------------------------
Interaction with windows

Gtkbasic supports two ways.
The easiest uses 
gins_set()
and
gins_get()

To set a labeltext of a button:
gins_set( "button1" , "label" , "mytext" , "<str>" )

So it follows this scheme:
gins_set( widget , property , value , type )
type can be: <str> <int> <boolean> 

A special case is <uposition> , it just remains from an eary version.

To get a value, you use this scheme:
result = gins_get( widget , property , type )

Sometimes it might be difficult to know, what the correct "property" is.
In this case I have a look at project.glade with an editor.


The gins_ functions are easy to use, but have several limitations.
For this reason I added a function gtk(), that gives you direct access 
to the Gtk-API (Application Programming Interface).

gtk() always needs 6 arguments.
If the last one are unneeded, set them to 0.
To get the text of a button, it would look like this:
result = gtk( "gtk_button_get_label" , "button1" , 0 , 0 , 0 , 0 )

If you click on the "Gtk-docs" button in the IDE, you will see the C documentation of Gtk (online).
GtkBasic tries to be as close as possible to these functions, so you can use it to find out, what values are needed.

Do not get confused about the types mentioned there.
Things like gint can be ignored, as in GtkBasic you pass everything as a string.

Far not all functions ae supported yet.
An overview of supported ones soon will be added.

