Class: MG::TextField

Inherits:
Widget show all
Defined in:
doc/API_reference.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#alpha, #anchor_point, #color, #name, #position, #rotation, #scale, #size, #z_index

Constructors collapse

Instance Method Summary collapse

Methods inherited from Widget

#enabled=, #enabled?, #highlighted=, #highlighted?, #on_touch, #touch_enabled=, #touch_enabled?

Methods inherited from Node

#add, #children, #clear, #delete, #delete_from_parent, #intersects?, #number_of_running_actions, #parent, #run_action, #schedule, #schedule_once, #stop_action, #stop_all_actions, #unschedule, #visible=, #visible?

Constructor Details

#initialize(placeholder = '', font = '', font_size = 0) ⇒ TextField

Creates a new Text widget with optional content, font name and size.

Parameters:

  • placeholder (String) (defaults to: '')

    text of placeholder.

  • font (String) (defaults to: '')

    font name.

  • font_size (Integer) (defaults to: 0)

    font size.



1381
# File 'doc/API_reference.rb', line 1381

def initialize(placeholder='', font='', font_size=0); end

Instance Attribute Details

#fontString

Returns name of the font used by the widget.

Returns:

  • (String)

    name of the font used by the widget.



1390
1391
1392
# File 'doc/API_reference.rb', line 1390

def font
  @font
end

#font_sizeInteger

Returns size of the font used by the widget.

Returns:

  • (Integer)

    size of the font used by the widget.



1393
1394
1395
# File 'doc/API_reference.rb', line 1393

def font_size
  @font_size
end

#horizontal_align:left, ...

Returns the horizontal alignment of the text.

Returns:

  • (:left, :center, :right)

    the horizontal alignment of the text.



1410
1411
1412
# File 'doc/API_reference.rb', line 1410

def horizontal_align
  @horizontal_align
end

#placeholderString

Returns a placeholder string.

Returns:

  • (String)

    a placeholder string.



1387
1388
1389
# File 'doc/API_reference.rb', line 1387

def placeholder
  @placeholder
end

#stringString

Returns a string of TextField.

Returns:

  • (String)

    a string of TextField.



1396
1397
1398
# File 'doc/API_reference.rb', line 1396

def string
  @string
end

#vertical_align:top, ...

Returns the vertical alignment of the text.

Returns:

  • (:top, :center, :bottom)

    the vertical alignment of the text.



1407
1408
1409
# File 'doc/API_reference.rb', line 1407

def vertical_align
  @vertical_align
end

Instance Method Details

#on_event {|Symbol| ... } ⇒ self

Configures a block to be called when a slider event is received on the widget.

Yields:

  • (Symbol)

    the given block will be called when the event is received with a Symbol that describes the type of event, which can be :attach, :detach, :insert or :delete.

Returns:

  • (self)

    the receiver.



1418
# File 'doc/API_reference.rb', line 1418

def on_event; end

#password_enabled=(value) ⇒ Boolean

Toggle enable password input mode.

Returns:

  • (Boolean)

    true if enable password.



1404
# File 'doc/API_reference.rb', line 1404

def password_enabled=(value); end

#password_enabled?Boolean

Query whether password is enabled or not.

Returns:

  • (Boolean)

    true if enabled password.



1400
# File 'doc/API_reference.rb', line 1400

def password_enabled?; end