[Gtk-sharp-list] Problem when desensitizing button
Alexandros Frantzis
alfius at freemail.gr
Fri Jun 17 06:26:41 EDT 2005
Hello,
after clicking on a Gtk.Button, I desensitize it so that I can't click
it again until an (asynchronous) operation finishes. The problem is that
when the operation finishes and I make the button sensitive again, the
button can't be clicked immediately! I must first move the mouse cursor
outside the button and then in again before I am able to click.
Is there way around this?
Thank you,
Alexandros
For example:
------ Code Start ------
using System;
using Gtk;
class ButtonTest
{
Window win;
Button button;
public static void Main(string[] args)
{
Application.Init();
new ButtonTest();
Application.Run();
}
public ButtonTest()
{
win = new Window("Button Test");
win.DeleteEvent += OnWindowDeleteEvent;
button = new Button("Click me");
button.Clicked += OnButtonClicked;
win.Add(button);
win.ShowAll();
}
void OnButtonClicked(object o, EventArgs args)
{
button.Sensitive = false;
Console.WriteLine("Click!");
GLib.Timeout.Add(1000, OnTimeoutExpired);
}
bool OnTimeoutExpired()
{
button.Sensitive = true;
return false;
}
void OnWindowDeleteEvent(object o, EventArgs args)
{
Application.Quit();
}
}
----- Code End ------
More information about the Gtk-sharp-list
mailing list