Class: LUIT::ScannerInput
- Inherits:
-
Object
- Object
- LUIT::ScannerInput
- Defined in:
- lib/luit.rb
Instance Attribute Summary collapse
-
#scanning ⇒ Object
readonly
Returns the value of attribute scanning.
Instance Method Summary collapse
-
#initialize(holder, id, window) ⇒ ScannerInput
constructor
A new instance of ScannerInput.
- #scan ⇒ Object
- #stop ⇒ Object
- #update ⇒ Object
Constructor Details
#initialize(holder, id, window) ⇒ ScannerInput
Returns a new instance of ScannerInput.
169 170 171 172 173 174 |
# File 'lib/luit.rb', line 169 def initialize(holder, id, window) @field = Gosu::TextInput.new @window = window @holder = holder @id = id end |
Instance Attribute Details
#scanning ⇒ Object (readonly)
Returns the value of attribute scanning.
168 169 170 |
# File 'lib/luit.rb', line 168 def scanning @scanning end |
Instance Method Details
#scan ⇒ Object
188 189 190 191 |
# File 'lib/luit.rb', line 188 def scan @scanning = true @window.text_input = @field end |
#stop ⇒ Object
183 184 185 186 |
# File 'lib/luit.rb', line 183 def stop @scanning = false @window.text_input = nil if @window.text_input == @field end |
#update ⇒ Object
176 177 178 179 180 181 |
# File 'lib/luit.rb', line 176 def update if Gosu::(Gosu::KbReturn) && @scanning @holder.onScan(@field.text) @field.text = "" end end |