Date: Thu, 10 Jul 2003 15:34:07 +0100 To: lablgtk at kaba.or.jp Subject: Dialog to select from a list Message-ID: <20030710143407.GA31869 at redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline From: Richard Jones I've got a list of objects with titles, and I want the user to select one. I want to carry out some action when the user has selected something. This seems pretty simple, but I'm stuck. Does anyone have code to do this? So far I have: (* "New chart" dialog. *) let new_chart () = let dialog = GWindow.dialog ~modal:true ~width:320 ~height:240 ~title:"Choose a chart" () in dialog#connect#destroy ~callback:dialog#destroy; let lst = GList.clist ~columns:1 ~selection_mode:`SINGLE ~packing:dialog#vbox#add () in List.iter (fun chart -> match chart with | StackedBarChart (title, _) -> lst#append [title]; () | PieChart (title, _) -> lst#append [title]; ()) all_charts; let ok_button = GButton.button ~label:"Display chart" ~packing:dialog#action_area#add () in let cancel_button = GButton.button ~label:"Cancel" ~packing:dialog#action_area#add () in cancel_button#connect#clicked ~callback:dialog#destroy; dialog#show (); 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. MAKE+ is a sane replacement for GNU autoconf/automake. One script compiles, RPMs, pkgs etc. Linux, BSD, Solaris. http://www.annexia.org/freeware/makeplus/