pharo-spec / mars-gtk

The Gtk3 bindings for Pharo and Spec
14 stars 6 forks source link

KeyPressEvent propagation does not work #39

Open pavel-krivanek opened 4 years ago

pavel-krivanek commented 4 years ago

If I'm not wrong, when event callback returns false, the default event propagation and processing should continue. It does not seem to work.

GtkApplication ensureRunning.
textEditor := GtkEntry new.
textEditor connectKeyPressEvent:  [ :event |
    event isEscape ifTrue: [ #Esc traceCr ]. 
    false ].
window := GtkWindow new
        title: ' Example';
        add: (GtkBox newVertical
            packStart: (textEditor)
            expand: true 
            fill: true
            padding: 0;
            yourself);
        showAll
pavel-krivanek commented 4 years ago

correct form:

GtkApplication ensureRunning.

textEditor := GtkEntry new.
textEditor connectKeyPressEvent:  [ :event |
    event isEscape ifTrue: [ #Esc traceCr ]. 
    textEditor imContextFilterKeypress: event.
    false ].

window := GtkWindow new
        title: ' Example';
        add: (GtkBox newVertical
            packStart: (textEditor)
            expand: true 
            fill: true
            padding: 0;
            yourself);
        showAll