mail-archives/gtk-sharp-list/2008-September/009057.html

240 строки
12 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Gtk-sharp-list] RichTextBox.TextChanged (event) equivalent in GTk.?
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:gtk-sharp-list%40lists.ximian.com?Subject=%5BGtk-sharp-list%5D%20RichTextBox.TextChanged%20%28event%29%20equivalent%20in%0A%09GTk.%3F&In-Reply-To=1222362919.15118.3.camel%40ubuntu-tower">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="009052.html">
<LINK REL="Next" HREF="009048.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Gtk-sharp-list] RichTextBox.TextChanged (event) equivalent in GTk.?</H1>
<B>True Friend</B>
<A HREF="mailto:gtk-sharp-list%40lists.ximian.com?Subject=%5BGtk-sharp-list%5D%20RichTextBox.TextChanged%20%28event%29%20equivalent%20in%0A%09GTk.%3F&In-Reply-To=1222362919.15118.3.camel%40ubuntu-tower"
TITLE="[Gtk-sharp-list] RichTextBox.TextChanged (event) equivalent in GTk.?">true.friend2004 at gmail.com
</A><BR>
<I>Thu Sep 25 21:58:36 EDT 2008</I>
<P><UL>
<LI>Previous message: <A HREF="009052.html">[Gtk-sharp-list] RichTextBox.TextChanged (event) equivalent in GTk.?
</A></li>
<LI>Next message: <A HREF="009048.html">[Gtk-sharp-list] Fwd: Message Status - Undeliverable
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#9057">[ date ]</a>
<a href="thread.html#9057">[ thread ]</a>
<a href="subject.html#9057">[ subject ]</a>
<a href="author.html#9057">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>This was the reason. The unlimited loop was due to last change when it put
back the modified text. Thanks David, it should work now.
Regards
On Thu, Sep 25, 2008 at 10:15 PM, David Cantin &lt;<A HREF="http://lists.ximian.com/mailman/listinfo/gtk-sharp-list">dcantin at gmail.com</A>&gt; wrote:
&gt;<i> I can do something like :
</I>&gt;<i>
</I>&gt;<i> protected virtual void OnTextBufferChanged(object o, System.EventArgs e)
</I>&gt;<i> {
</I>&gt;<i> string temp = this.textview1.Buffer.Text;
</I>&gt;<i> string temp1 = Regex.Replace(temp, &quot;[\x0011\x0012\u0060]&quot;,&quot;\'&quot;);
</I>&gt;<i> string temp2 = Regex.Replace(temp1, &quot;[\x0013\x0014]&quot;, &quot;\&quot;&quot;);
</I>&gt;<i> string temp3 = Regex.Replace(temp2, &quot;[+\x0017\x0005\x0015]&quot;, &quot;&quot;);
</I>&gt;<i> string temp4 = Regex.Replace(temp3, &quot;\x0016&quot;, &quot;-&quot;);
</I>&gt;<i>
</I>&gt;<i> this.textview1.Buffer.Changed -= new
</I>&gt;<i> EventHandler(OnTextBufferChanged);
</I>&gt;<i>
</I>&gt;<i> this.textview1.Buffer.Text = temp4;
</I>&gt;<i>
</I>&gt;<i> this.textview1.Buffer.Changed += new
</I>&gt;<i> EventHandler(OnTextBufferChanged);
</I>&gt;<i>
</I>&gt;<i> }
</I>&gt;<i>
</I>&gt;<i>
</I>&gt;<i>
</I>&gt;<i> Le jeudi 25 septembre 2008 &#224; 21:50 +0500, True Friend a &#233;crit :
</I>&gt;<i> &gt;
</I>&gt;<i> &gt; Ok I have added it to the MainWindow's constructor as follows.
</I>&gt;<i> &gt;
</I>&gt;<i> &gt; this.textview1.Buffer.Changed += new
</I>&gt;<i> &gt; EventHandler(OnTextBufferChanged);
</I>&gt;<i> &gt;
</I>&gt;<i> &gt; The evnt handler is as follows.
</I>&gt;<i> &gt; -----------------------------------------------
</I>&gt;<i> &gt; protected virtual void OnTextBufferChanged(object o, System.EventArgs
</I>&gt;<i> &gt; e)
</I>&gt;<i> &gt; {
</I>&gt;<i> &gt; string temp = this.textview1.Buffer.Text;
</I>&gt;<i> &gt; string temp1 = Regex.Replace(temp, &quot;[\x0011\x0012\u0060]&quot;,
</I>&gt;<i> &gt; &quot;\'&quot;);
</I>&gt;<i> &gt; string temp2 = Regex.Replace(temp1, &quot;[\x0013\x0014]&quot;,
</I>&gt;<i> &gt; &quot;\&quot;&quot;);
</I>&gt;<i> &gt; string temp3 = Regex.Replace(temp2, &quot;[+\x0017\x0005
</I>&gt;<i> &gt; \x0015]&quot;, &quot;&quot;);
</I>&gt;<i> &gt; string temp4 = Regex.Replace(temp3, &quot;\x0016&quot;, &quot;-&quot;);
</I>&gt;<i> &gt; this.textview1.Buffer.Text = temp4;
</I>&gt;<i> &gt; }
</I>&gt;<i> &gt; -------------------------------------------
</I>&gt;<i> &gt; And the result is an unlimited loop. Under is output at MD console
</I>&gt;<i> &gt; output.
</I>&gt;<i> &gt; --------------------------------------------
</I>&gt;<i> &gt; /usr/lib/libgobject-2.0.so.0(g_cclosure_marshal_VOID__VOID+0x4f)
</I>&gt;<i> &gt; [0xb6964aff]
</I>&gt;<i> &gt; /usr/lib/libgobject-2.0.so.0(g_closure_invoke+0x1ff) [0xb695782f]
</I>&gt;<i> &gt; /usr/lib/libgobject-2.0.so.0 [0xb696c329]
</I>&gt;<i> &gt; /usr/lib/libgobject-2.0.so.0(g_signal_emit_valist+0x8ef)
</I>&gt;<i> &gt; [0xb696dc1f]
</I>&gt;<i> &gt; /usr/lib/libgobject-2.0.so.0(g_signal_emit+0x29) [0xb696df69]
</I>&gt;<i> &gt; /usr/lib/libgtk-x11-2.0.so.0 [0xb6d56a7c]
</I>&gt;<i> &gt; /usr/lib/libgtk-x11-2.0.so.0 [0xb6cb5b38]
</I>&gt;<i> &gt; /usr/lib/libgobject-2.0.so.0 [0xb6956079]
</I>&gt;<i> &gt; /usr/lib/libgobject-2.0.so.0(g_closure_invoke+0x1ff) [0xb695782f]
</I>&gt;<i> &gt; /usr/lib/libgobject-2.0.so.0 [0xb696c11a]
</I>&gt;<i> &gt; /usr/lib/libgobject-2.0.so.0(g_signal_emit_valist+0x8ef)
</I>&gt;<i> &gt; [0xb696dc1f]
</I>&gt;<i> &gt; /usr/lib/libgobject-2.0.so.0(g_signal_emit+0x29) [0xb696df69]
</I>&gt;<i> &gt; /usr/lib/libgtk-x11-2.0.so.0 [0xb6d51422]
</I>&gt;<i> &gt; /usr/lib/libgtk-x11-2.0.so.0(gtk_text_buffer_set_text+0xbe)
</I>&gt;<i> &gt; [0xb6d5254e]
</I>&gt;<i> &gt; /usr/lib/libgobject-2.0.so.0(g_object_set_property+0x403)
</I>&gt;<i> &gt; [0xb695eb13]
</I>&gt;<i> &gt; [0xb664c759]
</I>&gt;<i> &gt; [0xb664c654]
</I>&gt;<i> &gt; [0xb407f2da]
</I>&gt;<i> &gt; [0xb407f526]
</I>&gt;<i> &gt; [0xb6651733]
</I>&gt;<i> &gt; [0xb66490d8]
</I>&gt;<i> &gt; /usr/lib/libgobject-2.0.so.0(g_cclosure_marshal_VOID__VOID+0x4f)
</I>&gt;<i> &gt; [0xb6964aff]
</I>&gt;<i> &gt; /usr/lib/libgobject-2.0.so.0(g_closure_invoke+0x1ff) [0xb695782f]
</I>&gt;<i> &gt; /usr/lib/libgobject-2.0.so.0 [0xb696c329]
</I>&gt;<i> &gt; /usr/lib/libgobject-2.0.so.0(g_signal_emit_valist+0x8ef)
</I>&gt;<i> &gt; [0xb696dc1f]
</I>&gt;<i> &gt; /usr/lib/libgobject-2.0.so.0(g_signal_emit+0x29) [0xb696df69]
</I>&gt;<i> &gt; /usr/lib/libgtk-x11-2.0.so.0 [0xb6d56a7c]
</I>&gt;<i> &gt; /usr/lib/libgtk-x11-2.0.so.0 [0xb6cb5b38]
</I>&gt;<i> &gt; /usr/lib/libgobject-2.0.so.0 [0xb6956079]
</I>&gt;<i> &gt; /usr/lib/libgobject-2.0.so.0(g_closure_invoke+0x1ff) [0xb695782f]
</I>&gt;<i> &gt; /usr/lib/libgobject-2.0.so.0 [0xb696c11a]
</I>&gt;<i> &gt; /usr/lib/libgobject-2.0.so.0(g_signal_emit_valist+0x8ef)
</I>&gt;<i> &gt; [0xb696dc1f]
</I>&gt;<i> &gt; /usr/lib/libgobject-2.0.so.0(g_signal_emit+0x29) [0xb696df69]
</I>&gt;<i> &gt; /usr/lib/libgtk-x11-2.0.so.0 [0xb6d51422]
</I>&gt;<i> &gt; /usr/lib/libgtk-x11-2.0.so.0(gtk_text_buffer_set_text+0xbe)
</I>&gt;<i> &gt; [0xb6d5254e]
</I>&gt;<i> &gt; /usr/lib/libgobject-2.0.so.0(g_object_set_property+0x403)
</I>&gt;<i> &gt; [0xb695eb13]
</I>&gt;<i> &gt; [0xb664c759]
</I>&gt;<i> &gt; [0xb664c654]
</I>&gt;<i> &gt; [0xb407f2da]
</I>&gt;<i> &gt; [0xb407f526]
</I>&gt;<i> &gt; [0xb6651733]
</I>&gt;<i> &gt; [0xb66490d8]
</I>&gt;<i> &gt; /usr/lib/libgobject-2.0.so.0(g_cclosure_marshal_VOID__VOID+0x4f)
</I>&gt;<i> &gt; [0xb6964aff]
</I>&gt;<i> &gt; /usr/lib/libgobject-2.0.so.0(g_closure_invoke+0x1ff) [0xb695782f]
</I>&gt;<i> &gt; /usr/lib/libgobject-2.0.so.0 [0xb696c329]
</I>&gt;<i> &gt; /usr/lib/libgobject-2.0.so.0(g_signal_emit_valist+0x8ef)
</I>&gt;<i> &gt; [0xb696dc1f]
</I>&gt;<i> &gt; /usr/lib/libgobject-2.0.so.0(g_signal_emit+0x29) [0xb696df69]
</I>&gt;<i> &gt; ---------------------------------------------------
</I>&gt;<i> &gt; So any ideas?
</I>&gt;<i> &gt; Regards
</I>&gt;<i> &gt; On Thu, Sep 25, 2008 at 9:27 PM, True Friend
</I>&gt;<i> &gt; &lt;<A HREF="http://lists.ximian.com/mailman/listinfo/gtk-sharp-list">true.friend2004 at gmail.com</A>&gt; wrote:
</I>&gt;<i> &gt; Thanks. After trying different events finally I added it to
</I>&gt;<i> &gt; filesave event handler. I'll try this as well.
</I>&gt;<i> &gt; Regards
</I>&gt;<i> &gt;
</I>&gt;<i> &gt;
</I>&gt;<i> &gt;
</I>&gt;<i> &gt; On Thu, Sep 25, 2008 at 9:22 PM, Chris Howie
</I>&gt;<i> &gt; &lt;<A HREF="http://lists.ximian.com/mailman/listinfo/gtk-sharp-list">cdhowie at gmail.com</A>&gt; wrote:
</I>&gt;<i> &gt; On Thu, Sep 25, 2008 at 7:00 AM, True Friend
</I>&gt;<i> &gt; &lt;<A HREF="http://lists.ximian.com/mailman/listinfo/gtk-sharp-list">true.friend2004 at gmail.com</A>&gt; wrote:
</I>&gt;<i> &gt; &gt; HI
</I>&gt;<i> &gt; &gt; I am working on a simple application. I had same in
</I>&gt;<i> &gt; winforms where I added
</I>&gt;<i> &gt; &gt; above (in subject) said event handler so when I
</I>&gt;<i> &gt; pasted some text or text
</I>&gt;<i> &gt; &gt; changed in rich text box the method was called and
</I>&gt;<i> &gt; it made some
</I>&gt;<i> &gt; &gt; modifications in text. Can you tell me what is its
</I>&gt;<i> &gt; equal in gtk? I tried to
</I>&gt;<i> &gt; &gt; search textview events but couldn't find an
</I>&gt;<i> &gt; appropriate one which can work
</I>&gt;<i> &gt; &gt; as textchanged event...
</I>&gt;<i> &gt;
</I>&gt;<i> &gt;
</I>&gt;<i> &gt; Much of GTK+ uses the MVC (Model, View, and
</I>&gt;<i> &gt; Controller) model. In
</I>&gt;<i> &gt; this case, TextView is the view and TextBuffer is the
</I>&gt;<i> &gt; model. The
</I>&gt;<i> &gt; changed event is on the TextBuffer, so:
</I>&gt;<i> &gt;
</I>&gt;<i> &gt; this.someTextView.Buffer.Changed +=
</I>&gt;<i> &gt; this.OnSomeTextViewChanged;
</I>&gt;<i> &gt;
</I>&gt;<i> &gt; --
</I>&gt;<i> &gt; Chris Howie
</I>&gt;<i> &gt; <A HREF="http://www.chrishowie.com">http://www.chrishowie.com</A>
</I>&gt;<i> &gt; <A HREF="http://en.wikipedia.org/wiki/User:Crazycomputers">http://en.wikipedia.org/wiki/User:Crazycomputers</A>
</I>&gt;<i> &gt;
</I>&gt;<i> &gt;
</I>&gt;<i> &gt;
</I>&gt;<i> &gt;
</I>&gt;<i> &gt; --
</I>&gt;<i> &gt; Muhammad Shakir Aziz &#1605;&#1581;&#1605;&#1583; &#1588;&#1575;&#1705;&#1585; &#1593;&#1586;&#1740;&#1586;
</I>&gt;<i> &gt;
</I>&gt;<i> &gt;
</I>&gt;<i> &gt;
</I>&gt;<i> &gt;
</I>&gt;<i> &gt;
</I>&gt;<i> &gt; --
</I>&gt;<i> &gt; Muhammad Shakir Aziz &#1605;&#1581;&#1605;&#1583; &#1588;&#1575;&#1705;&#1585; &#1593;&#1586;&#1740;&#1586;
</I>&gt;<i> &gt;
</I>&gt;<i> &gt;
</I>&gt;<i> &gt; _______________________________________________
</I>&gt;<i> &gt; Gtk-sharp-list maillist - <A HREF="http://lists.ximian.com/mailman/listinfo/gtk-sharp-list">Gtk-sharp-list at lists.ximian.com</A>
</I>&gt;<i> &gt; <A HREF="http://lists.ximian.com/mailman/listinfo/gtk-sharp-list">http://lists.ximian.com/mailman/listinfo/gtk-sharp-list</A>
</I>&gt;<i>
</I>&gt;<i>
</I>
--
Muhammad Shakir Aziz &#1605;&#1581;&#1605;&#1583; &#1588;&#1575;&#1705;&#1585; &#1593;&#1586;&#1740;&#1586;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <A HREF="http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20080926/b3fa1960/attachment-0001.html">http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20080926/b3fa1960/attachment-0001.html</A>
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="009052.html">[Gtk-sharp-list] RichTextBox.TextChanged (event) equivalent in GTk.?
</A></li>
<LI>Next message: <A HREF="009048.html">[Gtk-sharp-list] Fwd: Message Status - Undeliverable
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#9057">[ date ]</a>
<a href="thread.html#9057">[ thread ]</a>
<a href="subject.html#9057">[ subject ]</a>
<a href="author.html#9057">[ 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>