Date: Mon, 08 Nov 2004 23:39:26 +0100 (CET) Message-Id: <20041108.233926.59464023.oandrieu at nerim.net> To: jcpouce at yahoo.com Cc: lablgtk at kaba.or.jp Subject: Re: destroy all objets in a canvas ? (lablgtk 2.4 + ocaml 3.08) From: Olivier Andrieu In-Reply-To: <20041108141115.37108.qmail at web41506.mail.yahoo.com> References: <20041108141115.37108.qmail at web41506.mail.yahoo.com> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi, > jean-charles campagne [Mon, 8 Nov 2004]: > I used to be able to erase all elements of a canvas > with functions like : > > List.iter GtkBase.Object.destroy r#get_items ; (* > where 'r' is the root of a canvas *) > > But it seems the types have changed in the new version > and broken this code... Right, GnoCanvas.group#get_items now returns a higher level object instead of a Gtk.obj for consistency with the rest of LablGTK. The GnoCanvas.base_item class derives from GObj.gtkobj which has a destroy method. So what you want is: List.iter (fun o -> o#destroy ()) r#get_items Another way to do this (I think) is to put all your object in a group and destroy that group (not sure if it's safe to do this on canvas#root though). -- Olivier