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

Widget Tab

From eyeOS Wiki

Contents

Introduction

The Tab widget is very useful for separating heterogeneous contents of an application. It consists in a bar containing the different tabs, each one containing its own content independently from the others. Tabs can also be added or removed at any time, and it is even possible to make some tabs closable by the user.

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 vertical 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.
  • width: sets the width of the widget, in pixels.
  • height: sets the height of the widget, in pixels.

Specific Keys

  • signal: specifies the signal to be sent to the system every time a tab is clicked.

Methods

 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.
 addFriendChild($friend,$tab)
  • Description: adds a friend of one of the tabs.
  • Arguments:
    • friend: friend widget to be added.
    • tab: name of the tab to add a friend to.
 addTab($tabname,$noclose=0)
  • Description: adds a new Tab.
  • Arguments:
    • tabname: name of the new tab.
    • noclose: specifies whether the new tab is closable (0) or not (non-zero value).
  • Return value: returns the name of the tab just created.
 getIdByName($tabname)
  • Description: returns the ID of a tab.
  • Arguments:
    • tabname: name of the tab.
 hide()
  • Description: makes the widget invisible.
  • Arguments: none.
 removeTab($tabid)
  • Description: removes a tab.
  • Arguments:
    • tabid: name of the tab to be closed.
 selectTab($tabName)
  • Description: selects a tab.
  • Arguments:
    • tabName: ID of the tab.
 selectByName($tabname)
  • Description: selects a tab.
  • Arguments:
    • tabName: name of the tab.
 selectTabContent($tabName)
  • Description: selects a tab's inner content.
  • Arguments:
    • tabName: ID of the tab.
 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. Remember that both the key and value of each element must be valid CSS properties and values respectively.
 setHeight($height)
  • Description: changes the height of the widget.
  • Arguments:
    • height: natural number specifying the new height.
 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. By default this widget is always serialized. If you don't want it to be serialized, just pass number 1 as the argument of its show method.