[gtkada] tasks

Dmitry A. Kazakov mailbox at dmitry-kazakov.de
Sun Dec 12 18:46:15 CET 2010


On Sun, 12 Dec 2010 15:29:45 +0100, you wrote:

> i would ask i which cases you need to use gtkada in a task,

1. A lengthy operation performed in a task that should indicate its 
progress in UI.

2. Asynchronous input, let you have some signal which need to be indicated 
in an oscilloscope widget. 

3. You might want to have multiple GUI windows doing something in parallel. 
It is natural to drive them from different tasks, otherwise you would have 
a design mess.

4. Better UI. The keyboard/mouse input, buttons shall never be blocked. 
I.e. any potentially lengthy call back, e.g. directory open in file chooser 
etc, must better be done from a task. Gtk is not very well designed for 
this. For example sorting tree models cannot be moved to a task. But it 
many cases it is possible to do.

> but i just think that i want to make a program which both allows user to
> make things in the user interface, and listen to a server if it wants to
> tell something to the user, and i don't know how to do that

You start the listener in a separate task.

> well, i think to manage the UI with the main task, and to listen to the
> server with the other task So, when the server wants to tell something to
> the user, how the other task should ask the main task to act on the UI ?

This is what

http://www.dmitry-kazakov.de/ada/gtkada_contributions.htm#1

was designed for. From the listener you would issue a request to the Gtk 
task to do something on behalf of the listener task.

> maybe it has to use gtkada itself at this time, but i don't know more how

See the example there. It starts a task, which does Set_Text into a 
Gtk_Label each 0.5s.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



More information about the gtkada mailing list