[Gtk-sharp-list] Force UI Update?

Jim Orcheson jim at va3hj.ca
Sun May 1 11:29:06 EDT 2011


I have a Gtk# application where the processing of a menu item may take 
many seconds. I want to change the cursor to a Watch before the actual 
processing takes place, and then change the cursor back to Arrow when 
done. For example:

OnMenuItem(...)
{
     DoSetupProcessing();
     this.GdkWindow.Cursor = new Gdk.Cursor(Gdk.CursorType.Watch);
     DoLongProcessing();
     this.GdkWindow.Cursor = new Gdk.Cursor(Gdk.CursorType.Arrow);
}

With this code the watch cursor is never displayed because UI updating 
normally only occurs during idle processing, which of course does not 
occur until after OnMenuItem returns.

Is there a way to force the update to display the watch cursor without 
DoLongProcessing using a separate thread?

Jim


More information about the Gtk-sharp-list mailing list