Mozilla Skin
BLOG | FORUMS | WIKI | DEVELOPERS | MY EYEOS | PROFESSIONAL SERVICES | PROJECT PAGE

Widget Textbox

From eyeOS Wiki

Contents

Introduction

The Textbox widget is a one-line text input field that can be used to put both password and plain text in it.

Widget Use

Available Generic Keys

  • horiz: specifies whether its horizontal coordinate must be taken from the left (0) or the right (1) border of its container element. Default is 0 (left).
  • vert: specifies whether its vertical coordinate must be taken from the top (0) or from the bottom (1) border of its container element. Default is 0 (top).
  • x: specifies the horizontal displacement inside its "father" element, in pixels. Default is 10 pixels.
  • y: specifies the vertical displacement inside its "father" element, in pixels. Default is 10 pixels.
  • cent: specifies how the widget should be centered. Possible values are:
    • 0: no centering. This is the default value.
    • 1: center both horizontal and vertically.
    • 2: center horizontally.
    • 3: center vertically.
    • 4: place the widget at the horizontal and vertical center of its container element.
    • 5: place the widget at the horizontal center of its container element.
    • 6: place the widget at the vertizal center of its container element.

Please note the difference between options 1-3 and options 4-6. Options 1-3 calculate the size of the widget to ensure that the center of the widget is placed at the central point of its container, while options 4-6 set the central point coordinates as the widget's position.

  • visible: toggles the widget visibility. Possible values are 0 (hidden) or 1 (visible). Default value is 1.
  • enabled: specifies whether the widget is enabled (usable) or not. Default value is 1 (enabled), while disabled value is 0.
  • width: sets the width of the widget, in pixels. Default is 200.

Specific Keys

  • password: specifies whether the input text in the Textbox will be shown as plain text (0) or as a password (1). Default value is 0.
  • text: sets the initial text in the Textbox.
  • noborder: specifies whether the textbox border must be drawn (0) or not (1). Default value is 0.


Methods

 addEnterEvent($event)
  • Description: defines the JS code that will be executed every time the Enter key is pressed when the Textbox is focused.
  • Arguments:
    • event: JS code to be executed.
 addEnterEventMsg($msg)
  • Description: sets the signal to be sent to the system every time the Enter key is pressed when the Textbox is focused.
  • Arguments:
    • msg: signal to set.
 addEvent($eventName,$eventFunc,$args = )
  • Description: makes the widget execute code every time certain event is triggered.
  • Arguments:
    • eventName: the name of the JS event. Example: onchange.
    • eventFunc: the JS code to be executed.
    • args: if any, the args passed to the system.
 disable()
  • Description: makes the widget unusable.
  • Arguments: none.
 enable()
  • Description: makes the widget usable.
  • Arguments: none.
 focus()
  • Description: makes this widget as the selected one.
  • Arguments: none.
 hide()
  • Description: makes the widget invisible.
  • Arguments: none.
 remove()
  • Description: removes this widget, along with its child widgets.
  • Arguments: none.
 select()
  • Description: turns the text inside of the Textbox selected.
  • Arguments: none.
 setAlign($align)
  • Description: specifies the align used for the inner text.
  • Arguments:
    • align: CSS text align type. Possible values are:
      • left**
      • right**
      • center**
      • justify**
 setCss($params)
  • Description: sets CSS atributes to a widget.
  • Arguments:
    • params: specifies, in the form of an associative array, the CSS attributes to be applied.
 setText($content)
  • Description: changes the text shown in the Textbox and updates if (if visible) to reflect the changes.
  • Arguments:
    • content: new text content in the Textbox.
 setValue($content)
  • Description: sets the text content of the Textbox.
  • Arguments:
    • content: new text content in the Textbox.
 setWidth($width)
  • Description: changes the width of the widget.
  • Arguments:
    • width: natural number specifying the new width.
 setX($x)
  • Description: changes the horizontal position of the widget.
  • Arguments:
    • x: natural number specifying the new X coordinate.
 setY($y)
  • Description: changes the vertical position of the widget.
  • Arguments:
    • y: natural number specifying the new Y coordinate.
 unhide()
  • Description: makes the widget visible.
  • Arguments: none.

Can be serialized

Yes. This widget is always serialized if no argument is passed to the show() method. You can avoid serializing it simply by passing number 1 as the argument of show().