Delivered-To: lablgtk at yquem.inria.fr DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type; bh=r6+ZdqT0Gu0I3XNnQvMLQDMJ3aaT/BDPx7X31lVYYyQ=; b=JiMuTiE4ETQ+G5UM8MPrLWqVA6bOeutIJxSIeuG2cR3DDCI9CV8itc4nFCZKFAISs5 maUCMMfE6081ixMb6sPny0lyN71Zn83yN0YQLmtRA+YtKN3vcCqO6SB+U9I/byUxRaLG VsshIqd6VqLl+VN3xOXqoMpOGMeqpucLPj6uo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=tALlzFEqeIN8joetBm0wsp/tKxQdR8I9hNDSAQqLvH5ioocRcjbJ7F7r6hzfVfciIn +XSqBlEf49UzXZLX2QT4wLNzXjovCkXsblf6qd6cG/pPpEe9kU2nWedNwYA9ZC9QaUrg gHvrcQM/UvueBniwqWFq50nEBWf8JSGUdIzf0= Message-ID: Date: Wed, 3 Sep 2008 00:22:58 -0400 From: "Jacques Le Normand" To: lablgtk at yquem.inria.fr MIME-Version: 1.0 Subject: [Lablgtk] removing and replacing anchors Mime-version: 1.0 Content-Type: multipart/mixed; boundary="===============1556569452==" Content-Length: 3233 --===============1556569452== Content-Type: multipart/alternative; boundary="----=_Part_17645_3654396.1220415778746" ------=_Part_17645_3654396.1220415778746 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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 () ------=_Part_17645_3654396.1220415778746 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline
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 ()

------=_Part_17645_3654396.1220415778746-- --===============1556569452== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Lablgtk mailing list Lablgtk@yquem.inria.fr http://yquem.inria.fr/cgi-bin/mailman/listinfo/lablgtk --===============1556569452==--