placing a cursor and scrolling automatically
- From: "Jacques Le Normand" <rathereasy gmail com>
- To: gtk-devel-list gnome org
- Subject: placing a cursor and scrolling automatically
- Date: Thu, 15 May 2008 15:21:06 -0400
Hello gtk-devel,
I've created a text view in a scrolled window and I'd like my scrolled window to automatically scroll whenever the cursor goes offscreen.
Here's my code(in ocaml)
open Gobject
let _ =
let source_window = GWindow.window () in
let scrolled_window = GBin.scrolled_window ~packing:source_window#add () in
let buffer = GText.buffer () in
let view = GText.view ~buffer:buffer ~packing:scrolled_window#add () in
buffer#insert "santo\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nsanto\nnot\n";
buffer#place_cursor (buffer#get_iter (`OFFSET 500));
source_window#show ();
source_window#maximize ();
GMain.Main.main ()
how can this be done?
cheers
--Jacques
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]