* GtkAda and timeout
@ 2021-09-16 11:18 AdaMagica
2021-09-16 13:05 ` Dmitry A. Kazakov
0 siblings, 1 reply; 4+ messages in thread
From: AdaMagica @ 2021-09-16 11:18 UTC (permalink / raw)
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.
Christoph
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: GtkAda and timeout
2021-09-16 11:18 GtkAda and timeout AdaMagica
@ 2021-09-16 13:05 ` Dmitry A. Kazakov
2021-09-16 18:07 ` AdaMagica
0 siblings, 1 reply; 4+ messages in thread
From: Dmitry A. Kazakov @ 2021-09-16 13:05 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: GtkAda and timeout
2021-09-16 13:05 ` Dmitry A. Kazakov
@ 2021-09-16 18:07 ` AdaMagica
2021-09-16 18:17 ` Dmitry A. Kazakov
0 siblings, 1 reply; 4+ messages in thread
From: AdaMagica @ 2021-09-16 18:07 UTC (permalink / raw)
Dmitry A. Kazakov schrieb am Donnerstag, 16. September 2021 um 15:05:36 UTC+2:
> 2. A timer queued to the GTK loop.
> 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.
It's this second option I'm trying. Doing slight progress...
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: GtkAda and timeout
2021-09-16 18:07 ` AdaMagica
@ 2021-09-16 18:17 ` Dmitry A. Kazakov
0 siblings, 0 replies; 4+ messages in thread
From: Dmitry A. Kazakov @ 2021-09-16 18:17 UTC (permalink / raw)
On 2021-09-16 20:07, AdaMagica wrote:
> Dmitry A. Kazakov schrieb am Donnerstag, 16. September 2021 um 15:05:36 UTC+2:
>> 2. A timer queued to the GTK loop.
>> 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.
>
> It's this second option I'm trying. Doing slight progress...
#1 is actually based on #2. It installs is a timer that periodically
checks if an Ada task requested some GTK action.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-09-16 18:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-16 11:18 GtkAda and timeout AdaMagica
2021-09-16 13:05 ` Dmitry A. Kazakov
2021-09-16 18:07 ` AdaMagica
2021-09-16 18:17 ` Dmitry A. Kazakov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox