Skip to content

Hello World

Saif Ahmed edited this page Nov 20, 2021 · 15 revisions

A simple window is identified by easily. The corners of a window are used by "+", and the borders with "-" and "|". The design requires a monospace font.

+-------------------+
|T Hello world      |
+-------------------+
|  Hello World      |
|                   |
+-------------------+

  • The first line determine the width of the window and the number of lines yields the height of the window (generally). It is possible to modify this by adding the pixel geometry in the first line e.g.
+-300x300-----------+
|T Hello world      |
+-------------------+
|  Hello World      |
+-------------------+

  • The title bar is drawn using the second line...the "T" indicates a title bar and the content that follows becomes the title of the window.
  • The third line is a separator.
  • The fourth line and those that follow determine the content. In this case a static text is written as text (surprise). As text is detected it's ID is presented on the console for further manipulation if needed with $frame->{stattext<id>} e.g.
# abstracted by GUIDeFAte and there portable across back-ends
$frame->setLabel("The button was clicked!",$id); 

# back-end specific code
$frame->{stattext21}->SetForegroundColour( Wx::Colour->new(255, 0, 0) );  

hello world

  • A blank line (or end of data) is where the line count stops.

Converting the text into a GUI

This is used like most perl modules. The "new" function in GUIDeFATE takes the string that is made, and converts it into an interface. It takes in addition two other two additional optional parameters. It is then run by calling MainLoop.

use GUIDeFATE;
my $gui=GUIDeFATE->new($window,$backend,$assist);
my $frame=$gui->getFrame;
$gui->MainLoop;

The $backend can be "wx", "tk" or "gtk"

The $assist can be

"v" for verbose....lists the widget references as it finds them with their functions "q" for quiet (Default) "a" for autogenerate. Creates "autogen.txt" file that contains the skeleton for the functions that may be needed for your application with hints as to which widgets are referenced to make coding easier. There is an Executioner app that allows you run the test programs with different backends in the scripts folder.

Clone this wiki locally