On 2021-09-16 13:18, AdaMagica wrote:
Example: a ticket automaton
When a ticket is selected (button press), the user has to insert coins (button press). If no coins are inserted within a certain time, the ticket selection is aborted.
Thus, I need a timeout that starts each time a button is pressed.
I'm struggling with the GtkAda RM and UG - no help. Also testgtk is no real help.
GTK is synchronous, there is no timeouts. You have two options:
1. An Ada task using a delay statement and then triggering GTK action.
2. A timer queued to the GTK loop.
Note that GTK is not multitasking, if you choose #1 you will need to
marshal actions to the GTK loop (the task running it). See the GtkAda contributions how to use tasks with GTK.
For the option #2 see GLib.Main, the function Timeout_Add and generic
package Generic_Sources queue a timer. When timer triggers you do your
stuff and then remove the timer.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)