934: def ask_for_order
935: dialog = Dialog.new(
936: "Give an order criterium for 'x'.",
937: nil, nil,
938: [ Stock::OK, Dialog::RESPONSE_ACCEPT ],
939: [ Stock::CANCEL, Dialog::RESPONSE_REJECT ]
940: )
941: hbox = HBox.new(false, 5)
942:
943: hbox.add(Label.new("Order:"))
944: hbox.pack_start(order_input = Entry.new)
945: order_input.text = @order || 'x'
946:
947: hbox.pack_start(reverse_checkbox = CheckButton.new('Reverse'))
948:
949: dialog.vbox.add(hbox)
950:
951: dialog.signal_connect('key-press-event''key-press-event', &DEFAULT_DIALOG_KEY_PRESS_HANDLER)
952: dialog.show_all
953: self.focus = dialog
954: dialog.run do |response|
955: if response == Dialog::RESPONSE_ACCEPT
956: return @order = order_input.text, reverse_checkbox.active?
957: end
958: end
959: return
960: ensure
961: dialog.destroy if dialog
962: end