Date: Fri, 25 Jul 2003 17:18:27 +0100 To: lablgtk at kaba.or.jp Subject: Setting sensitivity of menu items Message-ID: <20030725161826.GA25388 at redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline From: Richard Jones Hi: I'm creating a menu which looks like this: let factory = new GMenu.factory simulation_menu ~accel_group in factory#add_item "Start" ~key:_P ~callback:start_sim; factory#add_item "Pause" ~callback:pause_sim; factory#add_item "Stop" ~key:_S ~callback:stop_sim; Now I would like to enable/disable menu items using the #misc#set_sensitive method (eg. so that when the simulation is started, the Start button is disabled, and the Pause & Stop buttons are enabled). 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'. Short of assigning this to a reference, which seems a bit naff (and also lacks proper compile-time type safety), how can I do this? Rich. -- Richard Jones. http://www.annexia.org/ http://freshmeat.net/users/rwmj Merjis Ltd. http://www.merjis.com/ - all your business data are belong to you. All new technology is irrelevant until it is taken up by the public.