Class: Tuile::Component::FloatField::Field
- Inherits:
-
TextField
- Object
- Component
- AbstractStringField
- TextField
- Tuile::Component::FloatField::Field
- Defined in:
- lib/tuile/component/float_field.rb,
sig/tuile.rbs
Overview
The face: a TextField that admits only the buffers a float can be typed through, however the characters arrive.
Constant Summary collapse
- TYPEABLE =
Buffers reachable by typing a float: an optional leading
-, digits with at most one., and an optional exponent. Looser than NUMERIC on purpose —"","-","1."and"1e"are members, or the values past them could not be typed at all. /\A-?\d*(?:\.\d*)?(?:[eE][-+]?\d*)?\z/
Instance Attribute Summary
Attributes inherited from TextField
#left_column, #max_text_length, #on_enter, #on_key_down, #on_key_up
Attributes inherited from AbstractStringField
#caret, #on_change, #on_escape, #text
Attributes included from HasValue
Attributes included from HasValidation
Instance Method Summary collapse
-
#insert_text(str) ⇒ Boolean
Accepts the insertion only if the whole resulting buffer is still typeable, so a European
"1,5"is dropped rather than sieved into the plausible, wrong"15".
Methods inherited from TextField
#adjust_left_column, #column_at, #cursor_position, #display_text, #handle_caret_mutated, #handle_mouse_down?, #handle_text_input_key?, #handle_text_mutated, #handle_width_changed, #index_at, #initialize, #insert, #inspect_details, #placeholder, #placeholder=, #placeholder_row, #preprocess_paste, #repaint, #show_placeholder?, #snap_to_glyph_start, #text_columns, #visible_text
Methods included from HasPlaceholder
#inspect_details, #placeholder, #placeholder=
Methods inherited from AbstractStringField
#clear, #cluster_boundary_after, #cluster_boundary_before, #columns_of, #default_bg_color, #default_on_escape, #delete_at_caret, #delete_back_to, #delete_before_caret, #empty?, #empty_value, #error_bg_color, #error_ink?, #error_message, #error_message=, #focusable?, #handle_caret_mutated, #handle_key?, #handle_paste, #handle_text_input_key?, #handle_text_mutated, #initialize, #inspect_details, #preprocess_paste, #preprocess_text, #snap_to_cluster, #tab_stop?, #value, #value=, #word_left, #word_right
Methods included from HasValue
#clear, #empty?, #empty_value, #error_bg_color, #error_ink?, #error_message, #error_message=, #focusable?, #inspect_details, #value, #value=
Methods included from HasValidation
#error_bg_color, #error_ink?, #error_message, #error_message=, #inspect_details
Constructor Details
This class inherits a constructor from Tuile::Component::TextField
Instance Method Details
#insert_text(str) ⇒ Boolean
Accepts the insertion only if the whole resulting buffer is still
typeable, so a European "1,5" is dropped rather than sieved into the
plausible, wrong "15".
@param str
@return — true if the text changed.
72 73 74 75 76 |
# File 'lib/tuile/component/float_field.rb', line 72 def insert_text(str) return false unless TYPEABLE.match?(@text.dup.insert(@caret, str)) super end |