Class: Fugit::RunCommandDialog
- Inherits:
-
Dialog
- Object
- Dialog
- Fugit::RunCommandDialog
- Defined in:
- lib/fugit/run_command_dialog.rb
Instance Method Summary collapse
-
#initialize(parent) ⇒ RunCommandDialog
constructor
A new instance of RunCommandDialog.
- #on_ok ⇒ Object
- #show ⇒ Object
Constructor Details
#initialize(parent) ⇒ RunCommandDialog
Returns a new instance of RunCommandDialog.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/fugit/run_command_dialog.rb', line 5 def initialize(parent) super(parent, ID_ANY, "Run command", :size => Size.new(300, 100)) @cmd = TextCtrl.new(self, ID_ANY) butt_sizer = (OK|CANCEL) butt_sizer.get_children.map {|s| s.get_window}.compact.each {|b| b.set_label("Run") if b.get_label == "OK"} (get_affirmative_id, :on_ok) box = BoxSizer.new(VERTICAL) box.add(StaticText.new(self, ID_ANY, "Command:"), 0, EXPAND|ALL, 4) box.add(@cmd, 0, EXPAND|LEFT|RIGHT|BOTTOM, 4) box.add(butt_sizer, 0, EXPAND|BOTTOM, 4) self.set_sizer(box) end |
Instance Method Details
#on_ok ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/fugit/run_command_dialog.rb', line 29 def on_ok command = @cmd.get_value end_modal(ID_OK) @log_dialog ||= LoggedDialog.new(self, "Run command") @log_dialog.show @log_dialog.run_command(command) end |
#show ⇒ Object
22 23 24 25 26 27 |
# File 'lib/fugit/run_command_dialog.rb', line 22 def show() @cmd.set_value("") super() @cmd.set_focus end |