Class
Ltextbox
Home
In: locana/l_textbox.rb
Parent: Lobject

This is a single line textbox or input box allowing you to enter and edit text. Based on the Lobject class. Here are the attributes that are created specifically for the textbox object:

This class supports highlighting text using the keyboard or mouse and copying text to and from the clipboard.

Methods

auto_select, auto_select=, cursor_blinking, cursor_position, cursor_position=, default_bg, default_border, default_mouse_cursor, display_char, display_char=, highlighted?, hscroll_position, hscroll_position=, include_objects, inherit_color_from_parent?, inherits_attribute?, insert_mode, insert_mode=, ipadx, ipady, max_size, max_size=, nearest, on_backspace_key, on_change, on_copy, on_cut, on_delete_key, on_end_key, on_enter_key, on_exit, on_home_key, on_insert_key, on_key_press, on_left_key, on_mouse_ldn, on_mouse_lup, on_mouse_move, on_next_word, on_paste, on_prev_word, on_right_key, only_digits, only_digits=, paint_focus, paint_focus_remove, paint_normal, pixel_height, pixel_width, select_text, skip_object_theme, valid_attribute?, value, value=,
Public Instance methods
valid_attribute?(attribute, lvalue=nil) src

Supports the :text, :display_char, :max_size, :auto_select, :insert_mode attributes.

default_bg() src

Returns :sys_textbox_bg.

default_mouse_cursor() src

Returns :ibeam.

default_border() src

Returns :sunken.

inherits_attribute?(attr) src

Textbox and editbox objects don’t inherit the background color from the parent object.

inherit_color_from_parent?() src

Returns False because the textbox does not inherit color from it’s parent.

skip_object_theme() src

Returns true because the textbox does not pull attributes from the :object attribute of any style.

include_objects() src

Set up several instance variables and create a timer for blinking the cursor.

value=(new_text) src

Clears the selection or highlight and resets the cursor position. Raises LocanaDigitRequired when :allow_digits is true and new_text is not a Fixnum.

value() src

Retruns the text from the textbox. If :display_char is set, the :display_char is returned in place of the true value. When :display_char is set use self[:value] instead of self.value To get the real value.

insert_mode() src

Return the current state of insert_mode. The default is true.

insert_mode=(new_value) src

Sets the insert mode on or off.

display_char() src

Returns the character to display in place of the actual characters. Lpassword uses this to mask the actual characters. The default is nil.

display_char=(new_value) src

This sets the character used to display in place of the actual characters. Lpassword automatically set this to ’*’ to mask the actual characters.

only_digits() src

Returns the only_digits attribute.

only_digits=(new_value) src

Sets the only_digits attribute. When new_value = true, only digits can be entered into the textbox.

auto_select() src

Return true if :auto_select is on and nil or false if :auto_select is off. The default is true.

auto_select=(new_value) src

Set the :auto_select attribute.

max_size() src

Returns the :max_size attribute. The default is nil which means there is no max size.

max_size=(new_value) src

Sets the :max_size attribute.

select_text(start_index=0, end_index=-1) src

Selects or highlights the text between start_index and end_index. Use (0, -1) to select all text. Use (0, 0) to clear the selection.

nearest(lx) src

Returns the index of the character closest to lx.

cursor_position() src

Returns the index of the character in :value where the cursor is positioned at.

cursor_position=(new_value) src

Relocates the cursor and makes sure it is always visible.

hscroll_position() src

Returns the index of the first visible character. The textbox will scroll horizontally when you type in more characters that you can see. Returns 0 if all characters are visible.

hscroll_position=(new_value) src

Sets the index of the first visible character. The textbox will scroll horizontally when you type in more characters than you can see.

on_change(levent=nil, &block) src

Sets the new cursor_position, sets self.value = levent[:value], and clears any highlighted text. The Lcombobox object relies on all of this the being set up properly.

on_exit(levent=nil, &block) src

Un-select or de-highlights any text.

on_paste(levent=nil, &block) src

Inserts the content of the clipboard into the textbox at the current cursor_position.

on_cut(levent=nil, &block) src

Cuts the highlighted text from the textbox and places it in the clipboard.

on_copy(levent=nil, &block) src

Copies the highlighted text from the textbox to the clipboard.

on_backspace_key(levent=nil, &block) src

Eliminates any highlighted text and the character before the cursor.

on_delete_key(levent=nil, &block) src

If there is any highlighted or selected text, it is removed from the textbox. Otherwise the character after the cursor is deleted.

on_insert_key(levent=nil, &block) src

Toggles insert mode on/off.

on_key_press(levent=nil, &block) src

Inserts the pressed character into the textbox and triggers the on_change event. Raises LocanaDigitRequired when :allow_digits is true and you attempt to type a non digit character in the text box.

on_home_key(levent=nil, &block) src

Moves the cursor to the first character in the textbox.

on_end_key(levent=nil, &block) src

Moves the cursor to the last character in the textbox.

on_next_word(levent=nil, &block) src

Called whenever the user presses a ctrl-right_key to move to the next word. Holding the shift key will highlight the next word.

on_prev_word(levent=nil, &block) src

Called whenever the user does a ctrl-left_key to move to the previous word. Holding the shift key will highlight the previous word.

on_left_key(levent=nil, &block) src

Moves the cursor one character to the left. Holding the ctrl key will forward this to on_prev_word. Holding the shift key will highlight the previous character.

on_right_key(levent=nil, &block) src

Moves the cursor one character to the right. Holding the ctrl key will forward this to on_next_word. Holding the shift key will highlight the next character.

on_enter_key(levent=nil, &block) src

Moves the keyboard focus to the next object (calls on_next_object).

on_mouse_ldn(levent=nil, &block) src

Repositions the cursor and clears any highlight. This also prepares for dragging the highlight as the mouse is moved.

on_mouse_lup(levent=nil, &block) src

Clears any preparations for dragging the highlight as the mouse is moved.

on_mouse_move(levent=nil, &block) src

Drags or expands the highlight when left mouse button is pressed.

paint_normal() src

Paints the text in the textbox and takes into consideration any highlighted or selected text.

highlighted?(idx) src

Returns true if the character at idx is highlighted. Otherwise returns false.

cursor_blinking(show_cursor, start_timer=true) src

This draws the cursor (focus indicator), removes the cursor, and causes the cursor to blink. Ltextbox::CURSOR_BLINK_TIME determines the rate of blinking.

paint_focus() src

This adds anything needed to the object to show that it has the focus. This calls cursor_blinking() to draw the cursor, remove the cursor, and blink the cursor.

paint_focus_remove() src

This should undo or remove the focus painted by paint_focus. This calls cursor_blinking() to draw the cursor, remove the cursor, and blink the cursor.

pixel_width() src

Returns the pixel width of the text in the object. This should take into consideration the font, size, and style of the object and it’s parents. This is used to calculate width of the object when needed.

pixel_height() src

Returns the pixel height of the text in the object. This should take into consideration the font, size, and style of the object and it’s parents. This is used to calculate height of the object when needed.

ipadx() src

The default is 3 so the text does not hug the left and right border.

ipady() src

The default is 1 so the text does not hug the top and bottom border.


Seva Software


Thank you for taking the time to visit this web page. I trust you found the information contained in this page useful.
Please email any questions, concerns, or issues with this web site to webmaster@sevasoftware.com.
Please remember Seva Software when your company would benefit from an experienced database architect and software engineer.

http://www.arunadb.org http://www.locana.org http://www.ruby-lang.org http://www.coolwell.org http://www.sevasoftware.com