mail-archives/gtk-sharp-list/2005-June/005996.html

132 строки
3.4 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Gtk-sharp-list] Problem when desensitizing button
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:gtk-sharp-list%40lists.ximian.com?Subject=%5BGtk-sharp-list%5D%20Problem%20when%20desensitizing%20button&In-Reply-To=">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="006000.html">
<LINK REL="Next" HREF="005997.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Gtk-sharp-list] Problem when desensitizing button</H1>
<B>Alexandros Frantzis</B>
<A HREF="mailto:gtk-sharp-list%40lists.ximian.com?Subject=%5BGtk-sharp-list%5D%20Problem%20when%20desensitizing%20button&In-Reply-To="
TITLE="[Gtk-sharp-list] Problem when desensitizing button">alfius at freemail.gr
</A><BR>
<I>Fri Jun 17 06:26:41 EDT 2005</I>
<P><UL>
<LI>Previous message: <A HREF="006000.html">[Gtk-sharp-list] Unstable and Stable version
</A></li>
<LI>Next message: <A HREF="005997.html">[Gtk-sharp-list] Problem when desensitizing button
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#5996">[ date ]</a>
<a href="thread.html#5996">[ thread ]</a>
<a href="subject.html#5996">[ subject ]</a>
<a href="author.html#5996">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>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(&quot;Button Test&quot;);
win.DeleteEvent += OnWindowDeleteEvent;
button = new Button(&quot;Click me&quot;);
button.Clicked += OnButtonClicked;
win.Add(button);
win.ShowAll();
}
void OnButtonClicked(object o, EventArgs args)
{
button.Sensitive = false;
Console.WriteLine(&quot;Click!&quot;);
GLib.Timeout.Add(1000, OnTimeoutExpired);
}
bool OnTimeoutExpired()
{
button.Sensitive = true;
return false;
}
void OnWindowDeleteEvent(object o, EventArgs args)
{
Application.Quit();
}
}
----- Code End ------
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="006000.html">[Gtk-sharp-list] Unstable and Stable version
</A></li>
<LI>Next message: <A HREF="005997.html">[Gtk-sharp-list] Problem when desensitizing button
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#5996">[ date ]</a>
<a href="thread.html#5996">[ thread ]</a>
<a href="subject.html#5996">[ subject ]</a>
<a href="author.html#5996">[ author ]</a>
</LI>
</UL>
<hr>
<a href="http://lists.ximian.com/mailman/listinfo/gtk-sharp-list">More information about the Gtk-sharp-list
mailing list</a><br>
</body></html>