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=7TWyzc9yVM8OTOosVFCQtp/R874qz6aMn3+QDjZ9670=; b=OyAqdNFqY1iT3Lw6I5Eu0RWK7M2SJZoupou1MXp3OTN9pBRHiA85zwRym+x2DjB8LZ XA7bZxk/aio2eoyTeGZ9AwWrmPocJymnowCK11SrOAQKyKOolNAyWQ6GtUolk667TG7M bisng6mUgNmDQXbcitVxy9/KaM1hrRmFLRkyQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=QRyClK/FVf6/KIE/KyDFb80es77+IN/9STT1nRxZRX37cj/369ALcz6lhUlYm/4KMA Lf3sGkvb479nMTfH4s2Ujnr/1bosZnuhdIciHlTGflO4T9/4bJTwj/JRjwHrFtBTBQw7 jdrey/q5nlcHGJsIABPw4gJCXaIbMCsv2l8vw= Message-ID: Date: Thu, 7 Aug 2008 02:37:54 -0400 From: "Jacques Le Normand" To: lablgtk at yquem.inria.fr MIME-Version: 1.0 Subject: [Lablgtk] text tag signals Mime-version: 1.0 Content-Type: multipart/mixed; boundary="===============0650587151==" Content-Length: 3535 --===============0650587151== Content-Type: multipart/alternative; boundary="----=_Part_22176_3631830.1218091074342" ------=_Part_22176_3631830.1218091074342 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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 () ------=_Part_22176_3631830.1218091074342 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline
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 ()

------=_Part_22176_3631830.1218091074342-- --===============0650587151== 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 --===============0650587151==--