Date: Fri, 21 Apr 2006 13:49:12 +1000 From: Erik de Castro Lopo To: lablgtk at math.nagoya-u.ac.jp Subject: Setting the cursor in a text_view object Message-Id: <20060421134912.5de86566.ocaml-erikd at mega-nerd.com> Organization: Erik Conspiracy Secret Labs Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII Content-Length: 1632 Hi all, Me again :-(. I need to change the cursor in a text_view object. I figured out how to do this in C; you need to hook the "realize" callback and then do a gtk_window_set_cursor there. The complete Ocaml equivalent is here: let main () = (* Make a window *) let window = GWindow.window ~title:"Title goes here" () in let vbox = GPack.vbox ~homogeneous:false ~packing:window#add () in let buffer = GText.buffer () in let tview = GText.view ~buffer:buffer ~editable:false ~width:200 ~height:200 ~packing:vbox#add () in tview#misc#set_can_focus false ; let cursor = Gdk.Cursor.create `LEFT_PTR in ignore (tview#misc#connect#realize ( fun () -> print_endline "Fix cursor in realize callback not working yet." ; Gdk.Window.set_cursor tview#misc#window cursor )) ; ignore (window#connect#destroy ~callback:GMain.Main.quit) ; print_endline "show" ; window#show () ; buffer#insert "This is the text\n\nand another line." ; GMain.Main.main () let _ = Printexc.print main () The above compiles and runs, but the text_view cursor does not change. Can anyone see why? TIA, Erik -- +-----------------------------------------------------------+ Erik de Castro Lopo +-----------------------------------------------------------+ "OS X is great that way. I put a copy of OS X on my coffee table, and it hasn't been hacked yet. Yes, I am using it as a server. I serve several meals on it every week." -- Anthony Minkoff