Date: Fri, 4 Jul 2003 11:56:38 +0100 To: lablgtk at kaba.or.jp Subject: Re: Infuriating problem with drawing areas Message-ID: <20030704105638.GA26341 at redhat.com> References: <20030703161253.GB15588 at redhat.com> <20030703163033.GA1641 at clipper.ens.fr> <20030703164112.GC15588 at redhat.com> <20030703164540.GA7487 at clipper.ens.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <20030703164540.GA7487 at clipper.ens.fr> From: Richard Jones I'm now down to this program, which doesn't crash, but doesn't render anything in the widget either. It does call the "repaint" function however, because it prints the message to stderr. Is there any way I can find out why the drawable isn't being drawn, or debug it further? Rich. ---------------------------------------------------------------------- open GMain open GdkKeysyms (* This is the widget corresponding to the main screen area under the menu.= *) let area =3D GPack.vbox () let create_drawing_area vbox =3D let da =3D GMisc.drawing_area ~packing:vbox#add () in let drawable =3D da#misc#realize (); new GDraw.drawable da#misc#window in drawable#set_background `WHITE; let repaint _ =3D prerr_endline "repaint ..."; drawable#polygon ~filled:true [ 10,100; 35,35; 100,10; 165,35; 190,100; 165,165; 100,190; 35,165; 10,100 ]; false in da#event#connect#expose ~callback:repaint; da#coerce (* let create_drawing_area vbox =3D let label =3D GMisc.label ~text: "I'm a label!" ~packing:vbox#add () in label#coerce *) let view_drawing () =3D let da =3D create_drawing_area area in List.iter area#remove area#children; area#add da (* area#misc#show_all () - uncommenting makes no difference *) let main () =3D let window =3D GWindow.window ~width:800 ~height:600 ~title:"LablGtk drawing area / graphs demo" () in let vbox =3D GPack.vbox ~packing:window#add () in window#connect#destroy ~callback: Main.quit; (* Menu bar *) let menubar =3D GMenu.menu_bar ~packing:vbox#pack () in let factory =3D new GMenu.factory menubar in let accel_group =3D factory#accel_group in let file_menu =3D factory#add_submenu "File" in let view_menu =3D factory#add_submenu "View" in (* File menu *) let factory =3D new GMenu.factory file_menu ~accel_group in factory#add_item "Quit" ~key:_Q ~callback: Main.quit; (* View menu *) let factory =3D new GMenu.factory view_menu ~accel_group in factory#add_item "View drawing" ~callback: view_drawing; (* Display the windows and enter Gtk+ main loop *) window#show (); vbox#add area#coerce; Main.main () ;; main ();; ---------------------------------------------------------------------- --=20 Richard Jones. http://www.annexia.org/ http://freshmeat.net/users/rwmj Merjis Ltd. http://www.merjis.com/ - all your business data are belong to y= ou. MONOLITH is an advanced framework for writing web applications in C, easier than using Perl & Java, much faster and smaller, reusable widget-based arch, database-backed, discussion, chat, calendaring: http://www.annexia.org/freeware/monolith/