Re: intercept nervous button clicks...



On Thu, 2005-02-10 at 02:16, Felix Kater wrote:
Hi,

in my app some actions behind buttons take time, so the button is
released not before the action is done. This is ok.

However, I need to prevent the user from clicking other buttons in the
meantime.

Set the window insensitive - or the buttons - and use a wait cursor to
tell the user the program is working and should not be disturbed :)

On 25 Sept Stefan Kost posted some code to achieve this:


// it is not nice to access the *private* member of the window, butthere
is
currently no other way
GdkWindow *window=GTK_WIDGET(self->private->main_window)->window;
GdkCursor *cursor=gdk_cursor_new(GDK_WATCH);

// set wait curosr and gray-out window
gdk_window_set_cursor(window,NULL);
gdk_cursor_unref(cursor)
gtk_widget_set_sensitive(GTK_WIDGET(self->private->main_window),TRUE);

// do loading ...

// restor the cursor and enable the window
gdk_window_set_cursor(window,NULL);
gtk_widget_set_sensitive(GTK_WIDGET(self->private->main_window),TRUE);


May be it works, I didn't tried, but It seems what you're looking for.


Regards.
-- 
Iago Rubio



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