PHP-GTK2 Cookbook Forum
Welcome, Guest
Please Login or Register.    Lost Password?
Re:change cursor appearance (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 0
TOPIC: Re:change cursor appearance
#698
neil (User)
Junior Boarder
Posts: 24
graphgraph
User Offline Click here to see the profile of this user
change cursor appearance 4 Months, 2 Weeks ago Karma: 1  
How do I change the appearance of the cursor, for example, to an hourglass, while waiting for the result of an sql query?

Thanks.

Neil.
 
  The administrator has disabled public write access.
#699
neil (User)
Junior Boarder
Posts: 24
graphgraph
User Offline Click here to see the profile of this user
Re:change cursor appearance 4 Months, 2 Weeks ago Karma: 1  
ps ... Perhaps 'cursor' should read 'mouse pointer'.
Neil.
 
  The administrator has disabled public write access.
#710
kksou (Admin)
Admin
Posts: 443
graph
User Online Now Click here to see the profile of this user
Re:change cursor appearance 4 Months, 1 Week ago Karma: 8  
Use the method as outlined in:

Sample Code 133: How to change cursor over clickable GtkLabel - Part 2 - using image file?

Set the cursor on the GtkWindow. I think it should work.

Since you're doing this on a long sql query, you will need to also use the technique as outlined in

Sample Code 68: How to display progress bar while processing long task - Part 2 using_idle_add?

to change the cursor through idle_add().

Regards,
/kksou
 
  The administrator has disabled public write access.
#712
neil (User)
Junior Boarder
Posts: 24
graphgraph
User Offline Click here to see the profile of this user
Re:change cursor appearance 4 Months, 1 Week ago Karma: 1  
Thanks kksou.

I was able to use your code as a starting point to search the php-gtk2 documentation.

For those interested, heres a quick example:

<?php


function on_click($w,$cursor)
{
$w->window->set_cursor(new GdkCursor($cursor));
}

$w = new GtkWindow;
$v = new GtkVbox;
$b1 = new GtkButton;
$b2 = new GtkButton;

$w->add($v);
$v->pack_start($b1);
$v->pack_start($b2);

$w->connect_simple('destroy', array('gtk', 'main_quit' ));

$b1->connect_simple('clicked','on_click',$w,Gdk::WATCH);
$b2->connect_simple('clicked','on_click',$w,Gdk::ARROW);

$w->show_all();

Gtk::main();

?>

Available cursor settings at: http://gtk.php.net/manual/en/gdk.enum.cursor.php

Neil.
 
  The administrator has disabled public write access.
Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop

Blog - Forum - Privacy Policy - Contact Us
Copyright © 2006-2009. kksou.com. All Rights Reserved