text tag signals

"Jacques Le Normand" <[email protected]>
Newsgroups gmane.comp.lang.ocaml.lib.gtk
Message-ID <[email protected]>
Hello lablgtk,
I'm trying to have a text tag alert me whenever I move my cursor over it
The problem is that the event never matches `ENTER_NOTIFY or `LEAVE_NOTIFY
(in fact, I think the event is always `MOTION_NOTIFY)
could someone tell me what I'm doing wrong?
thanks!
--Jacques

(* the following program prints "neither of the above" when you place your
cursor over the "hel" part *)
open Gobject
let _ =
  let source_window = GWindow.window () in
  let buffer = GText.buffer () in
  let _ = GText.view ~buffer:buffer ~packing:source_window#add  () in
    buffer#insert "hello world";
    let tag1 = buffer#create_tag [] in
    let cb ~origin:y z _ =
      match GdkEvent.get_type z with
      (`ENTER_NOTIFY : Gdk.Tags.event_type) ->
        print_endline "entering";false
    | (`LEAVE_NOTIFY : Gdk.Tags.event_type) ->
        print_endline "leaving";false
    | _ -> print_endline "neither of the above";yfalse
    in
      ignore (tag1#connect#event ~callback:cb);
      buffer#apply_tag tag1 (buffer#get_iter (`OFFSET 0)) (buffer#get_iter
(`OFFSET 3));
      source_window#show ();
      GMain.Main.main ()

_______________________________________________
Lablgtk mailing list
[email protected]
http://yquem.inria.fr/cgi-bin/mailman/listinfo/lablgtk
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.