mirror of
https://github.com/cyberarm/cyberarm_engine.git
synced 2025-12-16 13:12:34 +00:00
Added support for passing a filter method/proc to EditLine
This commit is contained in:
@@ -2,6 +2,7 @@ module CyberarmEngine
|
||||
class Element
|
||||
class EditLine < Button
|
||||
def initialize(text, options = {}, block = nil)
|
||||
@filter = options.delete(:filter)
|
||||
super(text, options, block)
|
||||
|
||||
@type = default(:type)
|
||||
@@ -17,6 +18,14 @@ module CyberarmEngine
|
||||
@text_input.text = text
|
||||
@last_text_value = text
|
||||
|
||||
if @filter && @filter.respond_to?(:call)
|
||||
@text_input.instance_variable_set(:@filter, @filter)
|
||||
|
||||
def @text_input.filter(text_in)
|
||||
@filter.call(text_in)
|
||||
end
|
||||
end
|
||||
|
||||
@offset_x, @offset_y = 0, 0
|
||||
|
||||
event(:begin_drag)
|
||||
|
||||
Reference in New Issue
Block a user