Building graphical user interfaces with GLADE and Gtk+/GtkAda Jacob - - PowerPoint PPT Presentation

building graphical user interfaces with glade and gtk
SMART_READER_LITE
LIVE PREVIEW

Building graphical user interfaces with GLADE and Gtk+/GtkAda Jacob - - PowerPoint PPT Presentation

LinuxDay/Cagliari 2004: GUI building with GLADE Building graphical user interfaces with GLADE and Gtk+/GtkAda Jacob Sparre Andersen <sparre@crs4.it> Please interrupt me when Im speaking too fast or otherwise am difficult to understand.


slide-1
SLIDE 1

LinuxDay/Cagliari 2004: GUI building with GLADE

Building graphical user interfaces with GLADE and Gtk+/GtkAda

Jacob Sparre Andersen <sparre@crs4.it> Please interrupt me when I’m speaking too fast

  • r otherwise am difficult to understand.

Questions are welcome at any time during the talk.

. – p.1/14

slide-2
SLIDE 2

LinuxDay/Cagliari 2004: GUI building with GLADE

Gtk+/GtkAda is a portable graphical user interface library. Applications written with Gtk+/GtkAda are - if you don’t try hard to make it different - portable between MacOS X, most Unixes and MS Windows. GLADE is a tool for creating graphical user interfaces using Gtk+/GtkAda. The talk will be a live presentation of how one can create a simple application with a graphical user interface.

. – p.2/14

slide-3
SLIDE 3

LinuxDay/Cagliari 2004: GUI building with GLADE

The task

Make a graphical user interface for proof-reading a spell checking dictionary. Given a string (hopefully a word) we want to ask the user if it is a correctly spelled word which class it belongs to (but only if it is correct) what its correct spelling is (but only if it is wrong)

. – p.3/14

slide-4
SLIDE 4

LinuxDay/Cagliari 2004: GUI building with GLADE

The tools

GLADE - the GUI builder GtkAda - the GUI library GNAT - the compiler Emacs - just a nice editor

. – p.4/14

slide-5
SLIDE 5

LinuxDay/Cagliari 2004: GUI building with GLADE

Some traps

Not all distributions come with working versions

  • f GLADE and GNAT. Debian works straight out
  • f the box, while Red Hat requires use of some

packages downloaded from a non-standard loca-

  • tion. GLADE doesn’t seem to work properly on

Mac OS X.

. – p.5/14

slide-6
SLIDE 6

LinuxDay/Cagliari 2004: GUI building with GLADE

First steps

Starting the GUI builder Setting up a project Creating a window Adding layout tables, a notebook and some buttons to the window Building the project source Compiling the program

. – p.6/14

slide-7
SLIDE 7

LinuxDay/Cagliari 2004: GUI building with GLADE

Adding a handler to a button

Attaching signal handlers Updating the generated project source Editing the generated handler:

Gdk.Main.Gdk_Exit (Error_Code => 0); quits

the program

. – p.7/14

slide-8
SLIDE 8

LinuxDay/Cagliari 2004: GUI building with GLADE

Changing text in the GUI

Adding a label and a textbox to the window Updating the generated project source

a

Editing the initialization routine to use the 1st command line argument to set the window title: Ada.Command_Line.Argument (1)

a Notice that this doesn’t destroy the handler we wrote before.

. – p.8/14

slide-9
SLIDE 9

LinuxDay/Cagliari 2004: GUI building with GLADE

Radio buttons

Extending an existing layout table Adding a group of radio buttons Adding a field to a window type Accessing a window object from a handler for

  • ne of its child widgets

Writing the result to standard output

. – p.9/14

slide-10
SLIDE 10

LinuxDay/Cagliari 2004: GUI building with GLADE

Extending the notebook

Extend the notebook with an additional page Adding an editable text box Include data from the editable text box in the

  • utput

. – p.10/14

slide-11
SLIDE 11

LinuxDay/Cagliari 2004: GUI building with GLADE

Extending the notebook (2)

Using the "Forward" button to switch pages Showing and hiding pages Changing the initialization routine

. – p.11/14

slide-12
SLIDE 12

LinuxDay/Cagliari 2004: GUI building with GLADE

Extending the notebook (3)

One more page Showing and hiding it as appropriate Call "Done" when "Forward" doesn’t change the page

. – p.12/14

slide-13
SLIDE 13

LinuxDay/Cagliari 2004: GUI building with GLADE

...

. – p.13/14

slide-14
SLIDE 14

LinuxDay/Cagliari 2004: GUI building with GLADE

Links

Starting point for GUI building with GLADE and Gtk+/GtkAda:

http://libre.act-europe.fr/GtkAda/

Starting point for programming in Ada:

http://www.adapower.com/?Command=Started

Newsgroup: comp.lang.ada

. – p.14/14