Class: Gtk::QuitOnKeypressEvent

Inherits:
Box
  • Object
show all
Defined in:
lib/gtk_paradise/examples/gtk4/204_quit_on_keypress_event.rb

Overview

Gtk::QuitOnKeypressEvent

Instance Method Summary collapse

Methods inherited from Box

#add_space, #left_aligned_text, #text

Constructor Details

#initialize(run_already = true) ⇒ QuitOnKeypressEvent

#

initialize

#


14
15
16
17
18
19
20
# File 'lib/gtk_paradise/examples/gtk4/204_quit_on_keypress_event.rb', line 14

def initialize(
    run_already = true
  )
  super(:horizontal)
  reset
  run if run_already
end

Instance Method Details

#resetObject

#

reset (reset tag)

#


32
33
# File 'lib/gtk_paradise/examples/gtk4/204_quit_on_keypress_event.rb', line 32

def reset
end

#runObject

#

run

#


38
39
40
41
42
43
44
45
46
# File 'lib/gtk_paradise/examples/gtk4/204_quit_on_keypress_event.rb', line 38

def run
  keycont = Gtk::EventControllerKey.new
  keycont.signal_connect(:key_pressed) {|widget, event|
    e 'WE WERE PRESSED!'
    pp event
  }
  add_controller(keycont)
  set_halign(:center)
end

#title?Boolean Also known as: title

#

title?

#

Returns:

  • (Boolean)


25
26
27
# File 'lib/gtk_paradise/examples/gtk4/204_quit_on_keypress_event.rb', line 25

def title?
  'Cahnged Events Example'
end