Getting the "busy" cursor to display.



I have a gtk (fortran) application that displays a progress monitor while
computing, and I would like to display the busy cursor while the program is
reading a large data file.

Right now what I have is:

To define the busy cursor and GDK window (module [global] variables).

   draw_window = gtk_widget_get_window(window)
   busy_cursor = gdk_cursor_new_for_display(gdk_display_get_default(), &
        & GDK_WATCH)

and then to activate/deactivate it:

 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 ! Set a busy cursor on the progress monitor (for reading the database)
 subroutine set_monitor_busy(is_busy)
   logical, intent(in) :: is_busy

   if (is_busy) then
      call gdk_display_sync(gdk_display_get_default())
      call gdk_window_set_cursor(draw_window, busy_cursor)
      call gdk_display_sync(gdk_display_get_default())
   else
      call gdk_display_sync(gdk_display_get_default())
      call gdk_window_set_cursor(draw_window, NULL)
      call gdk_display_sync(gdk_display_get_default())
   end if
 end subroutine set_monitor_busy

The just before I start to read the big file I have:
  call set_monitor_busy(.TRUE.)

and after reading:
 call set_monitor_busy(.FALSE.)

However, even with both gdk_display_sync calls as shown, sometimes the busy
cursor appears and sometimes it doesn't (in fact sometimes the whole window
shows blank until after the file read). The commonest case is that the
monitor window renders but still keeps the regular cursor.

Is there some other call (or calls) I should be making to force the updates
to take place?



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]