Sha256: faa8e71a891b534b2a7d36ce235fc6a4e1a845b7a745e14a0beed105b5661307

Contents?: true

Size: 452 Bytes

Versions: 9

Compression:

Stored size: 452 Bytes

Contents

require 'ffi-tk'

Tk.init

label = Tk::Label.new(Tk.root, text: 'Press any key to open the dialog')
label.pack

Tk.root.bind('<Key>'){
  answer = Tk.message_box(
    message: 'Really quit?',
    icon: :question,
    type: :yesno,
    detail: 'Select "Yes" to make the application exit')

  case answer
  when :yes
    exit
  when :no
    Tk.message_box(
      message: 'I know you like this application!',
      type: :ok)
    exit
  end
}

Tk.mainloop

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ffi-tk-2010.08.23 example/message_box.rb
ffi-tk-2010.08 example/message_box.rb
ffi-tk-2010.06 example/message_box.rb
ffi-tk-2010.03 example/message_box.rb
ffi-tk-2010.02 example/message_box.rb
ffi-tk-2010.01 example/message_box.rb
ffi-tk-2010.01.02 example/message_box.rb
ffi-tk-2009.12.14 example/message_box.rb
ffi-tk-2009.11.29 example/message_box.rb