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