MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17174.7471.801893.878547 at karryall.dnsalias.org> Date: Wed, 31 Aug 2005 23:12:15 +0200 From: Olivier Andrieu To: Jon Harrop Cc: lablgtk at math.nagoya-u.ac.jp Subject: Re: Infinite recursion In-Reply-To: <200508310810.08345.jon at ffconsultancy.com> References: <200508302025.30609.jon at ffconsultancy.com> <200508310810.08345.jon@ffconsultancy.com> Jon Harrop [Wednesday 31 August 2005] : > I have now translated most of my program from Tk to gtk. It is > mostly fine but I am now having a problem with infinite > recursion. I have a "list box" and an "entry" to edit the currently > selected row in the "list box". Making a selection in the list box > updates the entry. Editing the entry updates the list box (e.g. to > keep it sorted). This leads to the infinite recursion. What widgets are you using exactly ? Your listbox is GtkTreeView, right ? In that case, GtkTreeView support editing directly in the cell. You just have to set the "editable" property of the cell renderer : let r = GTree.cell_renderer_text [ `EDITABLE true ; ... ] in Also what signals are you connecting ? for the GtkEntry you have "changed" wihch is emitted whenever the content of the entry is changed. But there is also an "activate" signal, emitted when the user presses Enter. May be you should connect this one instead ? Ditto for GtkTreeView, you have a signal emitted when something is selected and there's a "row-activated" one which is emitted when the row is double-clicked. > Are they any standard ways to avoid such infinite recursion when > using lablgtk? The only ways that I have thought of so far are > rather dirty hacks (e.g. use a global to disable further > recursion). Another way: signal delivery can be block/unblocked, cf. GtkSignal.handler_block and GtkSignal.handler_unblock Hope this helps -- Olivier