removing and replacing anchors
"Jacques Le Normand" <[email protected]>
| Newsgroups | gmane.comp.lang.ocaml.lib.gtk |
|---|---|
| Message-ID | <[email protected]> |
Dear lablgtk,
my last post, about widgets not appearing in text views, has been resolved
(see below)
but, for some reason, a text entry which has been removed and then placed
again into the buffer loses its text
(very odd behaviour!)
could someone tell me what I'm doing wrong?
thanks
--Jacques
open Gobject
let clearTextBuffer (tb:GText.buffer) =
let a = tb#start_iter in
let b = tb#end_iter in
tb#delete a b
let _ =
let source_window = GWindow.window () in (* create a source window *)
let buffer = GText.buffer () in (* create a text buffer *)
let view = GText.view ~buffer:buffer ~packing:source_window#add () in (*
create a text view *)
let entry = GEdit.entry () in (* create a text entry *)
view#add_child_at_anchor (entry :> GObj.widget)
(buffer#create_child_anchor (buffer#get_iter (`OFFSET 0))); (* creates an
anchor AND adds it to the text_view *)
entry#set_text "hello";
clearTextBuffer buffer;
view#add_child_at_anchor (entry :> GObj.widget)
(buffer#create_child_anchor (buffer#get_iter (`OFFSET 0)));
source_window#misc#show_all ();
GMain.main ()
_______________________________________________
Lablgtk mailing list
[email protected]
http://yquem.inria.fr/cgi-bin/mailman/listinfo/lablgtk