How to use file_chooser_dialog

Richard Jones rich at annexia.org
Fri Mar 4 01:04:59 CET 2005


I can't work this one out.

So far I have this, but the Cancel button acts as an accept button.

  let callback () =
    let dialog = GWindow.file_chooser_dialog ~action:`OPEN () in
    dialog#add_select_button_stock `CANCEL `CANCEL;
    dialog#add_select_button_stock `OPEN `ACCEPT;
    if dialog#run () = `ACCEPT then (
      let filename = dialog#filename in
      Option.may
	(fun filename -> prerr_endline ("filename = " ^ filename)) filename;
    );
    dialog#destroy ()
  in
  open_item#connect#activate ~callback;

Rich.

-- 
Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology - http://merjis.com
Team Notepad - intranets and extranets for business - http://team-notepad.com




More information about the Lablgtk-list mailing list