Class: Gtk2AppLib::Dialogs::Entry

Inherits:
Gtk::Dialog
  • Object
show all
Defined in:
lib/gtk2applib/dialogs/entry.rb

Overview

Creates an entry dialog

Instance Method Summary (collapse)

Constructor Details

- (Entry) initialize(prompt, options)

Returns a new instance of Entry



8
9
10
11
12
13
14
15
# File 'lib/gtk2applib/dialogs/entry.rb', line 8

def initialize(prompt, options)
  @options = options
  super(@options[:TITLE],
    @options[:WINDOW], @options[:FLAGS], *@options[:DIALOG_BUTTONS])
  box = self.vbox
  Widgets::Label.new(prompt, box, *@options[:Label])
  @entry = Widgets::Entry.new(box, *@options[:Entry]) { self.response(1) }
end

Instance Method Details

- (Object) run



17
18
19
20
21
22
23
# File 'lib/gtk2applib/dialogs/entry.rb', line 17

def run
  self.show_all
  message = nil
  super { |response| message = @entry.text if response == 1 }
  self.destroy
  message
end