Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at ocaml.org.

Browse thread
event#connect#after
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Stalkern 2 <stalkern2@t...>
Subject: Re: "ocaml_beginners"::[] event#connect#after
Il Thursday 03 July 2003 19:06, Flavio ha scritto:
> <html><body>
>
>
> <tt>
> Hello all,<BR>
> <BR>
> Could someone please explain me (or point me to some doc) what <BR>
> event#connect#after method of Gedit.text or GWindow.window, ... does?<BR>
> <BR>

read the GTK doc: (http://www.gtk.org/tutorial1.2/gtk_tut-18.html found by 
typing "gtk event connect after" in a search engine)
-----------------------------------------------------------------------
The way an event (say "button_press_event") is handled, is: 

Start with the widget where the event occured. 
Emit the generic "event" signal. If that signal handler returns a value of 
TRUE, stop all processing. 
Otherwise, emit a specific, "button_press_event" signal. If that returns TRUE, 
stop all processing. 
Otherwise, go to the widget's parent, and repeat the above two steps. 
Continue until some signal handler returns TRUE, or until the top-level widget 
is reached.


Some consequences of the above are: 

Your handler's return value will have no effect if there is a default handler, 
unless you connect with gtk_signal_connect_after(). 
To prevent the default handler from being run, you need to connect with 
gtk_signal_connect() and use gtk_signal_emit_stop_by_name() - the return 
value only affects whether the signal is propagated, not the current 
emission.
-----------------------------------------------------------------------

Also, use 

$ ocamlbrowser -I +lablgtk

and subscribe to the ML
lablgtk@k...


> Another question: I noticed that giving a wrong argument (an integer
> greater <BR> than the maximum length of the text) to
> Gedit.text#set_position method (which <BR> puts the cursor to the n-th
> position in the textbox) lead to a segmentation <BR> fault of the program.
> I know that it's possible to have a segfault since <BR> that's an external
> call to some C code, but why the author of lablgtk doesn't <BR> use a ocaml
> function as a wrapper? 

You can ask Jacques Garrigue himself at lablgtk@k... , he often replies 
clearly even to simple questions

Ciao
Ernesto