example/message_box.rb in ffi-tk-2010.08.23 vs example/message_box.rb in ffi-tk-2018.02.20
- old
+ new
@@ -1,26 +1,29 @@
+# frozen_string_literal: true
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>'){
+Tk.root.bind('<Key>') do
answer = Tk.message_box(
message: 'Really quit?',
icon: :question,
type: :yesno,
- detail: 'Select "Yes" to make the application exit')
+ 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)
+ type: :ok
+ )
exit
end
-}
+end
-Tk.mainloop
\ No newline at end of file
+Tk.mainloop