[Gtk-sharp-list] How to show custom window and do the computation in the background

David S buttink at gmail.com
Fri Jun 25 16:16:02 EDT 2010


I dont know how you are doing the actual loading but I hope you are doing it
like this.

Create Dialog
Create BackgroundWorker.
Set BackgroundWorker DoWork function making sure to set the progress and
call ReportProgress.
Set BackgroundWorker ReportProgress function making sure all calls to gtk
are Gtk.Application.Invoke.
Show Dialog.
Run BackgroundWorker.

If not, you are probably loading in the thread that GTK is using to actually
update.

On Fri, Jun 25, 2010 at 3:56 PM, Maciej Pilichowski <bluedzins at wp.pl> wrote:

> Hello,
>
> On Friday 25 June 2010 20:39:03 Christopher David Howie wrote:
>
> > On 06/25/2010 02:17 PM, Maciej Pilichowski wrote:
> > >   So -- how to have both worlds, show the dialog and do the
> > > computation?
> >
> > http://www.mono-project.com/Responsive_Applications
>
> Thank you for this link, I see similar approach as for WPF. However I
> still didn't do it right, I tried:
>
>                Gtk.Application.Invoke (delegate{ dlg.Run(); });
>
> or dlg.Show(). Now neither of calls shows the dialog.
>
>
>  Just in case -- computation is loading a big file. Loading occurs
> when user chooses a file in a file dialog. At start I show main
> window and -- if user set argument for a program -- I set initial
> filename for file dialog.
>
> --> show main window
> --> create file dialog
> --> set filename for file dialog
> --> the above triggers loading a file
> --> create progress dialog
> --> show progress dialog (*)
> --> load file
>
> (*) this does not work
>
> Cheers,
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20100625/e2917f6e/attachment.html 


More information about the Gtk-sharp-list mailing list