World of Hello
Public Member Functions | List of all members
CreateTable Class Reference

a table element. More...

Inheritance diagram for CreateTable:
element event

Public Member Functions

 CreateTable (int x=0, int y=0, int w=100, int h=200)
 create a table element. More...
 
element addColumn (string column, int col=this:getColumnCount())
 adds a column to the table. More...
 
element addColumn (string[] columns, int col=this:getColumnCount())
 adds multiple columns to the table. More...
 
void addItem (string txt,...)
 adds a row item to the table. More...
 
element addItem (int rowInd, string txt,...)
 adds a row item to the table at an index position. More...
 
element removeItem (int rowInd=this:getItemCount() -1)
 removes a row item at an index position. More...
 
int getItemCount ()
 gets the amount of rows in the table. More...
 
element setColumnName (int col, string newName)
 sets the name of a column, if it exists. More...
 
element setColumnName (string colName, string newName)
 sets the name of a column, if it exists. More...
 
string getColumnName (int col)
 gets the name of a column, if it exists. More...
 
int getColumnCount ()
 removes a column, if it exists. More...
 
element setColumnWidth (int col, int width)
 sets the width of a column, if it exists. More...
 
int getColumnWidth (int col)
 gets the width of a column, if it exists. More...
 
element setCellText (int row, int col, string text)
 sets the given cell's text, if it exists. More...
 
string getCellText (int row, int col)
 gets the given cell's text, if it exists. More...
 
element setSelected (int ind)
 sets the selected item by index. More...
 
int getSelected ()
 gets the selected item by index. More...
 
string[] getItem (int ind)
 gets a row item at the index. More...
 
element setActiveColumn (int col, bool sort=true)
 sets whether or not the given column should be sorted, if it exists. More...
 
element setActiveColumn (string colName, bool sort=true)
 sets whether or not the given column should be sorted, if it exists. More...
 
int getActiveColumn ()
 gets the active sorted column by index, starting at 0. More...
 
element setCellColor (int row, int col, int r, int g, int b, int a=255)
 sets the color of the given cell, if it exist. More...
 
- Public Member Functions inherited from element
conditional< string, bool > runScript ()
 run the element's script once. More...
 
element setRunScript (bool runScript=true)
 runs the script each frame. More...
 
element setScript (string code)
 set the element's script. More...
 
string getScript ()
 get the current code of the element. More...
 
conditional< string, bool > doScriptString (string code)
 does a script string. More...
 
element blockFunction (string functionName, bool block=true)
 blocks a function from being used outside of the current script. More...
 
string getID ()
 get the ID of the element. More...
 
bool setID (string ID)
 set the ID of the element. More...
 
float getX ()
 get the X axis of the element. More...
 
float getY ()
 get the Y axis of the element. More...
 
float getWidth ()
 get the width of the element. More...
 
float getHeight ()
 get the height of the element. More...
 
element bringToFront ()
 brings the element to the top-most layer. More...
 
element bringToBack ()
 brings the element to the bottom-most layer. More...
 
element setX (float X)
 sets the X axis of the element More...
 
element setY (float Y)
 sets the Y axis of the element. More...
 
element setWidth (float width)
 sets the width of the element. More...
 
element setWidth (float height)
 sets the height of the element. More...
 
element setScale (float scale)
 sets the scale of the element. More...
 
element setScale (float widthScale, float heightScale)
 sets the width and height scale of the element. More...
 
element setMaintainAspectRatio (bool maintainAspectRatio=true)
 sets whether or not changing the width/height maintains aspect ratio scaling. More...
 
element center ()
 centers the element. More...
 
element setScalePosition ()
 sets that setScale() should also scale the element's position. More...
 
element setScalePosition (bool scalePosition)
 sets whether or not setScale() should also scale the element's position. More...
 
element setScalePosition (bool scaleX, bool scaleY)
 sets whether or not setScale() should also scale the element's X and Y position. More...
 
element setCollisionWith (element elem)
 add collision with another element. More...
 
element removeCollisionWith (element elem)
 removes the collision with another element. More...
 
element setMinWidth (float minWidth)
 sets the minimum resize width. More...
 
element setMinHeight (float minHeight)
 sets the minimum resize height. More...
 
element setMaxWidth (float maxWidth)
 sets the maximum resize width. More...
 
element setMaxHeight (float maxHeight)
 sets the maximum resize height. More...
 
string getType ()
 get the type of this element. More...
 
element setPosition (float X, float Y)
 set the position of the element. More...
 
multiReturn< float, float > getPosition ()
 gets the position of the element. More...
 
element setTabEnabled (bool enabled=true)
 sets whether or not you can tab to get to this element. More...
 
element setTabOrder (int orderNo)
 sets the order in which this element can be tabbed to. More...
 
element setClipped (bool clipped)
 sets whether the element should be cut off by it's rectangle. More...
 
element setDPIAware (bool dpiAware=true)
 
element setDefaultControls (bool defaultControls, float speed)
 sets whether the element can be moves with keys. More...
 
element setFocused (bool focused=true)
 set the focus of the element. More...
 
bool isFocused ()
 get whether or not the element is in focus. More...
 
element setMovable (bool movable=true, int movableHeight=-1)
 sets the movability of the element. More...
 
element setMovableBoundaries (int x, int y, int endX, int endY)
 sets the movable boundaries. More...
 
multiReturn< int, int, int, int > getMovableBoundaries ()
 gets the movable boundaries. More...
 
bool hitsBoundary (string direction)
 checks if the element has collided with a boundary. More...
 
element setResizable (bool resizable=true)
 sets whether the element is resizable. More...
 
element setResizableDepth (int resizableDepth)
 sets the depth of the pixels the user must click to resize an element. More...
 
element setRect (int x, int y, int width, int height)
 sets the rectangle of the element. More...
 
element hide ()
 sets the element to be invisible. More...
 
element show ()
 sets the element to be visible. More...
 
element setVisible (bool visible=true)
 sets the visibility of the element. More...
 
bool isVisible ()
 get the visibility of the element. More...
 
element addElement (element elem)
 adds a child element. More...
 
element setParent (element elem)
 adds this element as a child of the given element. More...
 
element removeElement (element elem)
 removes a child element. More...
 
element[] getElements ()
 gets all child elements. More...
 
element getParent ()
 get the parent element. More...
 
element resetLayers ()
 resets the order of the layers. More...
 
void remove ()
 removes the element. More...
 
string getObject (bool includeChildren=true)
 get the element as a total object. More...
 
element doCommands (string cmd)
 creates the element from an object like a server command. More...
 
element removeFromClients ()
 removes the element from all online clients. More...
 
element sendToClients (bool removeOthers=false, string key="", string keyAns="")
 sends the element to all connected clients who meet the criteria. More...
 
element setProperty (string property, string value)
 sets a property of the element to be sent next. More...
 
string getProperty (string property)
 gets the value of a set property. More...
 
string[] getProperties ()
 gets all properties from the object. More...
 
element removeProperty (string property)
 removes a property from the object. More...
 
element clearProperties ()
 removes all properties from the object. See removeProperty() More...
 
bool setParentScript (string scriptPath)
 sets the parent script. More...
 
- Public Member Functions inherited from event
void setEventListener (ElementEvent event, function func,...)
 sets a function to run on the given event. Removes all other event listeners of the same event type. More...
 
void addEventListener (ElementEvent event, function func,...)
 adds a function to run on the given event. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from element
static void drawRectangle (int x, int y, int width=100, int height=50, bool border=false, int r=0, int g=0, int b=0, int a=255, clipX=0, clipY=0, clipWidth=game:getWindowWidth(), clipHeight=game:getWindowHeight())
 draws a 2D rectangle on top of the element. More...
 

Detailed Description

a table element.

Constructor & Destructor Documentation

◆ CreateTable()

CreateTable::CreateTable ( int  x = 0,
int  y = 0,
int  w = 100,
int  h = 200 
)

create a table element.

   Creates a table.\n
   Derives all element functions.
Parameters
(optional)The X axis the window should be placed on the screen.
(optional)The Y axis the window should be placed on the screen.
(optional)The width of the window.
(optional)The height of the window.

Member Function Documentation

◆ addColumn() [1/2]

element CreateTable::addColumn ( string  column,
int  col = this:getColumnCount() 
)

adds a column to the table.

Parameters
Thename of the column.
(optional)The index of the column to add.
Returns
Returns itself.

◆ addColumn() [2/2]

element CreateTable::addColumn ( string[]  columns,
int  col = this:getColumnCount() 
)

adds multiple columns to the table.

   Adds multiple columns to the table. If an index, col, is given then the columns will be added
   in the order they appear from the given columns table.
Parameters
Thenames of the columns.
(optional)The index of the column to add.
Returns
Returns itself.

◆ addItem() [1/2]

element CreateTable::addItem ( int  rowInd,
string  txt,
  ... 
)

adds a row item to the table at an index position.

Parameters
Therow index of item to be inserted (starting at 0).
Textto be added to the row's first column.
(optional)Any number of string arguments to be added to the row's next column.
Returns
Returns itself.

◆ addItem() [2/2]

void CreateTable::addItem ( string  txt,
  ... 
)

adds a row item to the table.

Parameters
Textto be added to the row's first column.
(optional)Any number of string arguments to be added to the row's next column.

◆ getActiveColumn()

int CreateTable::getActiveColumn ( )

gets the active sorted column by index, starting at 0.

Returns
The column that is sorted.

◆ getCellText()

string CreateTable::getCellText ( int  row,
int  col 
)

gets the given cell's text, if it exists.

Parameters
Therow's index (starting at 0).
Thecolumn's index (starting at 0).
Returns
The cell's text.

◆ getColumnCount()

int CreateTable::getColumnCount ( )

removes a column, if it exists.

Parameters
elementremoveColumn(int col)
Thecolumn index (starting at 0).
Returns
Returns itself.

removes a column, if it exists.

   Removes a column by the given name. If multiple columns with the same name exist, they are all removed.
Parameters
elementremoveColumn(string colName)
Thename of the column.
Returns
Returns itself.

gets the amount of columns in the table.

Returns
The number of columns.

◆ getColumnName()

string CreateTable::getColumnName ( int  col)

gets the name of a column, if it exists.

Parameters
Thecolumn index (starting at 0).
Returns
The name of the column.

◆ getColumnWidth()

int CreateTable::getColumnWidth ( int  col)

gets the width of a column, if it exists.

Parameters
Thecolumn index (starting at 0).
Returns
The column's width, if it exists. Otherwise, nil.

◆ getItem()

string [] CreateTable::getItem ( int  ind)

gets a row item at the index.

Parameters
Theindex of the row, starting 0.
Returns
A list of strings corresponding to the row's data by column.

◆ getItemCount()

int CreateTable::getItemCount ( )

gets the amount of rows in the table.

Returns
The amount of items.

◆ getSelected()

int CreateTable::getSelected ( )

gets the selected item by index.

Returns
The index of the item that is selected, starting at 0.

◆ removeItem()

element CreateTable::removeItem ( int  rowInd = this:getItemCount() -1)

removes a row item at an index position.

Parameters
(optional)If given and exists, removes an item at the index position (starting at 0). Otherwise, if not given, removes the last row item.
Returns
Returns itself.

◆ setActiveColumn() [1/2]

element CreateTable::setActiveColumn ( int  col,
bool  sort = true 
)

sets whether or not the given column should be sorted, if it exists.

   Sets if the column should be ordered or not.
   There may only be one active column at a time.
Parameters
Thecolumn by index, starting at 0.
(optional)Whether or not the column should be sorted.
Returns
Returns itself.

◆ setActiveColumn() [2/2]

element CreateTable::setActiveColumn ( string  colName,
bool  sort = true 
)

sets whether or not the given column should be sorted, if it exists.

   Sets if the column should be ordered or not.
   There may only be one active column at a time.<br>
   If more than one column with the same name exists, only the first is sorted.
Parameters
Thecolumn by name.
(optional)Whether or not the column should be sorted.
Returns
Returns itself.

◆ setCellColor()

element CreateTable::setCellColor ( int  row,
int  col,
int  r,
int  g,
int  b,
int  a = 255 
)

sets the color of the given cell, if it exist.

Parameters
Therow index (starting at 0).
Thecolumn index (starting at 0).
Theamount of red (0-255).
Theamount of green (0-255).
Theamount of blue (0-255).
(optional)The amount of alpha transparency (0-255).
Returns
Returns itself.

◆ setCellText()

element CreateTable::setCellText ( int  row,
int  col,
string  text 
)

sets the given cell's text, if it exists.

Parameters
Therow's index (starting at 0).
Thecolumn's index (starting at 0).
Thetext to set.
Returns
Returns itself.

◆ setColumnName() [1/2]

element CreateTable::setColumnName ( int  col,
string  newName 
)

sets the name of a column, if it exists.

Parameters
Thecolumn index (starting at 0).
Thenew name of the column.
Returns
Returns itself.

◆ setColumnName() [2/2]

element CreateTable::setColumnName ( string  colName,
string  newName 
)

sets the name of a column, if it exists.

   Renames a column. If multiple columns with the same name exist, they are all renamed.
Parameters
Thecolumn's current name.
Thenew name of the column.
Returns
Returns itself.

◆ setColumnWidth()

element CreateTable::setColumnWidth ( int  col,
int  width 
)

sets the width of a column, if it exists.

Parameters
Thecolumn index (starting at 0).
Thecolumn's new width in pixels.
Returns
Returns itself.

◆ setSelected()

element CreateTable::setSelected ( int  ind)

sets the selected item by index.

Parameters
Theindex of the item to be selected, starting at 0.
Returns
Returns itself.