955: def ask_for_order
956: dialog = Dialog.new(
957: "Give an order criterium for 'x'.",
958: nil, nil,
959: [ Stock::OK, Dialog::RESPONSE_ACCEPT ],
960: [ Stock::CANCEL, Dialog::RESPONSE_REJECT ]
961: )
962: hbox = HBox.new(false, 5)
963:
964: hbox.pack_start(Label.new("Order:"), false)
965: hbox.pack_start(order_input = Entry.new)
966: order_input.text = @order || 'x'
967: order_input.width_chars = 60
968:
969: hbox.pack_start(reverse_checkbox = CheckButton.new('Reverse'), false)
970:
971: dialog.vbox.pack_start(hbox, false)
972:
973: dialog.signal_connect('key-press-event''key-press-event', &DEFAULT_DIALOG_KEY_PRESS_HANDLER)
974: dialog.show_all
975: self.focus = dialog
976: dialog.run do |response|
977: if response == Dialog::RESPONSE_ACCEPT
978: return @order = order_input.text, reverse_checkbox.active?
979: end
980: end
981: return
982: ensure
983: dialog.destroy if dialog
984: end