Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2005-04

FPC and GTK2: signal handlers

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Jan Je/lowicki

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);

where

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

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

------------------------------------------------------------------- Wroclaw University of Agriculture Akademia Rolnicza we Wroclawiu Department of Mathematics Katedra Matematyki -------------------------------------------------------------------