To: rich at annexia.org Cc: lablgtk at kaba.or.jp Subject: Re: Setting sensitivity of menu items In-Reply-To: <20030725161826.GA25388 at redhat.com> References: <20030725161826.GA25388 at redhat.com> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20030726222011K.garrigue at kurims.kyoto-u.ac.jp> Date: Sat, 26 Jul 2003 22:20:11 +0900 From: Jacques Garrigue Lines: 21 From: Richard Jones > But my start_sim function doesn't have access to the actual menu > item. eg if I do: > > let start = factory#add_item "Start" ~key:_P ~callback:(start_sim start) in > > I get an error about unbound value 'start'. Olivier's answer (using start#connect later) is of course the right one. But if you are fond of functional tricks, you can also use a lazy value: let rec start = lazy (factory#add_item "Start" ~key:_P ~callback:(fun () -> start_sim (Lazy.force start))) in let start = Lazy.force start in This is safe, but this is really a stupid thing to do in this case. Jacques