comp.lang.ada
 help / color / mirror / Atom feed
* Is this an Gtk issue or an Ada issue or even a OS issue? Unwanted parallel processing
@ 2022-10-18  6:30 ldries46
  2022-10-18 19:52 ` Ludovic Brenta
  0 siblings, 1 reply; 4+ messages in thread
From: ldries46 @ 2022-10-18  6:30 UTC (permalink / raw)


I have the following problem, which I can solve in my case but I still 
want to know how to solve in a general way.
Case:
In an Ada program I use the Gtk Filechooser with the On_OK routine. In 
that routine I read the chosen file and start some other calculations I 
need to do on that file (call for a new dialogue witin a callback from a 
higher level).  But these calculations are depending on the extension of 
the file. In some cases I even need another dialogue to decide which 
type o f calculations I have to follow. The program can only go on after 
this manual choice is made. But I see that the program goes on without 
waiting on that last dialogue to be closed.
Is there a way in Gtk to solve this or in Ada to block that obvious 
parallel processing or must I look for a solution within the operating 
system (Windows 11)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Is this an Gtk issue or an Ada issue or even a OS issue? Unwanted parallel processing
  2022-10-18  6:30 Is this an Gtk issue or an Ada issue or even a OS issue? Unwanted parallel processing ldries46
@ 2022-10-18 19:52 ` Ludovic Brenta
  2022-10-21 11:46   ` ldries46
  0 siblings, 1 reply; 4+ messages in thread
From: Ludovic Brenta @ 2022-10-18 19:52 UTC (permalink / raw)


ldries46 <bertus.dries@planet.nl> writes:

> I have the following problem, which I can solve in my case but I still
> want to know how to solve in a general way.
> Case:
> In an Ada program I use the Gtk Filechooser with the On_OK routine. In
> that routine I read the chosen file and start some other calculations
> I need to do on that file (call for a new dialogue witin a callback
> from a higher level).  But these calculations are depending on the
> extension of the file. In some cases I even need another dialogue to
> decide which type o f calculations I have to follow. The program can
> only go on after this manual choice is made. But I see that the
> program goes on without waiting on that last dialogue to be closed.
> Is there a way in Gtk to solve this or in Ada to block that obvious
> parallel processing or must I look for a solution within the operating 
> system (Windows 11)

I'm not sure what goes on "in parallel".  Have you started any tasks in
your Ada program?

If you want a modal dialog, you run it with Gtk.Dialog.Run, which starts
a nested event loop and does not process inputs in any other parts of
the GUI until the user closes this dialog causing Run to return.  Of
course, since you've read the documentation on Gtk.Dialog, I assume this
is how you open your dialog.  So, what is your problem exactly?

-- 
Ludovic Brenta.
The Managing Principal Vice Co-Director of Business Operations re-aggregates long-range co-innovations. 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Is this an Gtk issue or an Ada issue or even a OS issue? Unwanted parallel processing
  2022-10-18 19:52 ` Ludovic Brenta
@ 2022-10-21 11:46   ` ldries46
  2022-10-21 23:26     ` Ludovic Brenta
  0 siblings, 1 reply; 4+ messages in thread
From: ldries46 @ 2022-10-21 11:46 UTC (permalink / raw)


Op 18-10-2022 om 21:52 schreef Ludovic Brenta:
> ldries46 <bertus.dries@planet.nl> writes:
>
>> I have the following problem, which I can solve in my case but I still
>> want to know how to solve in a general way.
>> Case:
>> In an Ada program I use the Gtk Filechooser with the On_OK routine. In
>> that routine I read the chosen file and start some other calculations
>> I need to do on that file (call for a new dialogue witin a callback
>> from a higher level).  But these calculations are depending on the
>> extension of the file. In some cases I even need another dialogue to
>> decide which type o f calculations I have to follow. The program can
>> only go on after this manual choice is made. But I see that the
>> program goes on without waiting on that last dialogue to be closed.
>> Is there a way in Gtk to solve this or in Ada to block that obvious
>> parallel processing or must I look for a solution within the operating
>> system (Windows 11)
> I'm not sure what goes on "in parallel".  Have you started any tasks in
> your Ada program?
>
> If you want a modal dialog, you run it with Gtk.Dialog.Run, which starts
> a nested event loop and does not process inputs in any other parts of
> the GUI until the user closes this dialog causing Run to return.  Of
> course, since you've read the documentation on Gtk.Dialog, I assume this
> is how you open your dialog.  So, what is your problem exactly?
>
I have started my dialog with de show_all function. In this case the 
radio buttons and OK button do work correctly with show they did not 
work and with run they did not even appear in the dialog. I understand 
in the mean time that show and show all makes the program not stopping 
until the the dialog is completed and run stops the further running of 
the program until the dialog is stopped. Now I just need the run 
equivalent of show_all

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Is this an Gtk issue or an Ada issue or even a OS issue? Unwanted parallel processing
  2022-10-21 11:46   ` ldries46
@ 2022-10-21 23:26     ` Ludovic Brenta
  0 siblings, 0 replies; 4+ messages in thread
From: Ludovic Brenta @ 2022-10-21 23:26 UTC (permalink / raw)


ldries46 <bertus.dries@planet.nl> writes:
> I have started my dialog with de show_all function. In this case the
> radio buttons and OK button do work correctly with show they did not 
> work and with run they did not even appear in the dialog. I understand
> in the mean time that show and show all makes the program not stopping 
> until the the dialog is completed and run stops the further running of
> the program until the dialog is stopped. Now I just need the run 
> equivalent of show_all

From gtk-dialog.ads:
   --  Before entering the recursive main loop, Gtk.Dialog.Run calls
   --  Gtk.Widget.Show on the dialog for you. Note that you still need to show
   --  any children of the dialog yourself.

Gtk_Dialog_Record is a type extension of Gtk_Window_Record, which is a
type extension of Gtk_Bin_Record, so your Gtk_Dialog has a single child,
which you need to show (this child is the VBox described in the
documentation of Gtk_Dialog).

Therefore:
- call Gtk.Dialog.Gtk_New (D).
- Create your widgets, pack them into D.Get_Content_Area
- Create and pack any buttons (e.g. OK, Cancel, Help) into D.Get_Action_Area.
- call D.Get_Child.Show_All;
- call D.Run

-- 
Ludovic Brenta.
Our quest for quality will be best positioned to boost a resourceful, parallel and granular pre-plan. 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-10-21 23:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-18  6:30 Is this an Gtk issue or an Ada issue or even a OS issue? Unwanted parallel processing ldries46
2022-10-18 19:52 ` Ludovic Brenta
2022-10-21 11:46   ` ldries46
2022-10-21 23:26     ` Ludovic Brenta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox