Content-Type: text/plain; charset="iso-8859-1" From: Stalkern 2 Reply-To: stalkern2 at tin.it To: lablgtk at kaba.or.jp Subject: Re: Tree and Entry in a file viewer Date: Wed, 22 Jan 2003 14:51:28 +0100 References: <200301221333.27831.stalkern2 at tin.it> <200301221339.41315.stalkern2 at tin.it> In-Reply-To: <200301221339.41315.stalkern2 at tin.it> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <200301221451.28097.stalkern2 at tin.it> Does lablgtk support exception catching? As Maxence Guesdon suggested to me, I've a list of widgets, one of which may be a Label widget. In case it is a Label widget, I want to print its text. However, a callback like this: let callback_grab_name_of_item (treeAndButtonsObj : tree_and_buttons) () = let tree = treeAndButtonsObj #tree in match tree #selection with | [] -> () | selected -> match selected with [] -> () | hd::tl -> (let print_label_if_any (aWidget: GObj.widget) = (print_endline (try (aWidget #text) with _ -> "")) in List.iter print_label_if_any (hd#children); flush stdout);; gives when I launch lablgtk I get the following error: This expression has type Gtk.widget Gtk.obj It has no method text I wonder whether this is related to the lazyness of the evaluation of code. How could I come out of this issue? I would prefer not to call out the label by its position in the children list, both because I've some alignments that would be severely affected by changes between positions and because I regret to mix up lists and fixed positions in lists. TIA Ernesto