Re: Change mouse pointer to hourglass?



Torsten Schoenfeld wrote:

On Fri, 2004-08-13 at 00:21, Daniel Kasak wrote:
Is there any way to change the pointer to an hourglass?

Yes, use

 Gtk2::Gdk::Window::set_cursor.

For example:

 my $window = Gtk2::Window -> new();
 $window -> show_all();
 $window -> window -> set_cursor(Gtk2::Gdk::Cursor -> new("watch"));

I've got another issue now.
The mouse pointer change only takes effect *after* the rest of my code ( that the user is waiting for, hence the hourglass ) has finished.

I assume this has something do with with gtk only doing updates in 'idle' cycles. I found the following post in the archives that talks about something like this:
http://mail.gnome.org/archives/gtk-perl-list/2004-April/msg00021.html

So, can I do something like this?

# turn on hourglass
$mywindow->window->set_cursor(Gtk2::Gdk::Cursor->new("watch"));

Glib::Timeout->add (20, sub {
# do some stuff
   do_stuff();
# turn off hourglass
   $mywindow->window->set_cursor(Gtk2::Gdk::Cursor->new("left-ptr"));
   return 0
}

Can I be assured that the code will only run once, or can it be triggered again before the 1st run is completed?

--
Daniel Kasak
IT Developer
NUS Consulting Group
Level 5, 77 Pacific Highway
North Sydney, NSW, Australia 2060
T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
email: dkasak nusconsulting com au
website: http://www.nusconsulting.com.au
Title: CanIt Vote for ID 89538

The following links have been inserted by the NUS Consulting internal spam filter and are for NUS Consulting staff only
Spam
Not spam
Forget previous vote


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