def ask_for_order
dialog = Dialog.new(
"Give an order criterium for 'x'.",
nil, nil,
[ Stock::OK, Dialog::RESPONSE_ACCEPT ],
[ Stock::CANCEL, Dialog::RESPONSE_REJECT ]
)
hbox = HBox.new(false, 5)
hbox.pack_start(Label.new("Order:"), false)
hbox.pack_start(order_input = Entry.new)
order_input.text = @order || 'x'
order_input.width_chars = 60
hbox.pack_start(reverse_checkbox = CheckButton.new('Reverse'), false)
dialog.vbox.pack_start(hbox, false)
dialog.signal_connect('key-press-event''key-press-event', &DEFAULT_DIALOG_KEY_PRESS_HANDLER)
dialog.show_all
self.focus = dialog
dialog.run do |response|
if response == Dialog::RESPONSE_ACCEPT
return @order = order_input.text, reverse_checkbox.active?
end
end
return
ensure
dialog.destroy if dialog
end