[fpc-pascal] FPC and GTK2: signal handlers

Jan Je/lowicki Jasj at OZI.AR.WROC.PL
Wed Apr 20 11:26:38 CEST 2005

Hello all,

I am porting some pascal code from gtk 1.2 to 2.x using fpc 1.9.8.

Is there any difference between meaning of return values 
of signal callbacks in GTK+ 1.2 and 2.x?

I have troubles when I try to to GtkEntry a sevice, that would check 
whether some special key values were pressed, proceed specified 
action for them and next allow the default key-press handler to do 
its job:

    g_signal_connect(entry, 'key_press_event', @myhandler, nil);


    function myhandler(w: pGTKWidget; e: pGDKEvent; 
                       data: pointer):    boolean; cdecl;
      case e^.keyval of
      result := false;

In my opinion, returnig with FALSE should allow next callbacks 
connected to the same widget/event to be called; nevertheless they
are not called in my tests, including the default handler 
(gtk_combo_entry_key_press(), I guess).
Setting TRUE or FALSE as result of myhandler cannot change anything.

On the other side, when using g_signal_connect_after, the default 
handler stops the cascade on some key values, that are important 
for me (like Enter) -- although it allows user services on other keys.
It looks like the result value influenced spreading the signal.

I would like to run all the cascade of callbacks attached to single 
widget/event pairwhen I need, including default services. 
Is there any way to do it in GTK2 as easily as it was in GTK1.2?

With regards,

                                       Jan Jelowicki
                                       jasj at ozi.ar.wroc.pl
Wroclaw University of Agriculture    Akademia Rolnicza we Wroclawiu
Department of Mathematics            Katedra Matematyki

More information about the fpc-pascal mailing list