| javascript_components

# Class: Bs_Button Source Location: /components/toolbar/Bs_Button.class.js.php
### Class Overview
a button. #### Author(s): andrej arn <at blueshoes dot org> #### Copyright: blueshoes.org | ### Variables $action $actualizeFromChildren $backgroundColor $caption $cssClassDefault $cssClassMouseDown $cssClassMouseOver $group $height $id $imgName $imgPath $inactiveStyle $title $width $_constructor | ### Methods attachEvent attachFireOff dragStart drawInto drawOut getStatus mouseDown mouseOut mouseOver mouseUp numberOfAttachedEvents render setChildrenButtonBar setStatus setTitle _getId
### Inherited Variables | ### Inherited Methods
### Class Details [line 14] a button. #### Tags:
license: | developer
copyright: | blueshoes.org
author: | andrej arn <at blueshoes dot org>
[ Top ] ### Class Variables #### $action = [line 181] the action that should be done once the button got pushed. optional, but very useful in some circumstances. for example you attach an 'on' event - your custom function named buttonClicked(btnObj). as param you receive a reference to the button object (btnObj). then you can ask the btnObj.action and based on that information do what you need to do. #### Tags:
var: | action
since: | bs4.3
access: | public
Type: | string
[ Top ] #### $actualizeFromChildren = 0 [line 218] if this button has a children bar and a child element is clicked, should this button be updated? = no = only icon = only caption = both, icon and caption #### Tags:
var: | actualizeFromChildren
see: | var _childrenButtonBar
access: | public
Type: | int
[ Top ] #### $backgroundColor = [line 147] you can overwrite the background color that is specified in the css. #### Tags:
var: | backgroundColor (i recommend you use the hex code like '#ffffff', but you could also use a named color like 'white'.)
see: | var this.height
access: | public
Type: | mixed
[ Top ] #### $caption = [line 166] if you want to place a text next to the image that is always visible, use this var. #### Tags:
var: | caption
access: | public
Type: | string
[ Top ] #### $cssClassDefault = 'bsBtnDefault' [line 186]
Type: | mixed
[ Top ] #### $cssClassMouseDown = 'bsBtnMouseDown' [line 196]
Type: | mixed
[ Top ] #### $cssClassMouseOver = 'bsBtnMouseOver' [line 191]
Type: | mixed
[ Top ] #### $group = [line 59] this button can be added to a group. of all the buttons that are part of a group, only one can be active ("clicked down") at a time. it's also possible that none is "down". pushing another button down will release the other button. this feature can also be used to make a "toggle" button. just give it a unique group identifier, and you're done. #### Tags:
var: | group (anything, a string or int. all buttons with the same value belong to the same group.)
since: | bs4.4
access: | public
Type: | mixed
[ Top ] #### $height = [line 131] you can overwrite the height that is specified in the css. #### Tags:
var: | height (in pixel)
see: | var this.width
access: | public
Type: | int
[ Top ] #### $id = [line 44] an optional id for the span/div tag of this rendered element. if not specified then 'this.objectName + "_container"' will be used. #### Tags:
var: | id
access: | public
Type: | string
[ Top ] #### $imgName = [line 123] the image name. #### Tags:
var: | imgName
see: | var imgPath
access: | public
Type: | string
[ Top ] #### $imgPath = [line 115] the image path. if not specified then the one from the buttonbar will be used. if this button is not a member of a buttonbar then this._imgPathDefault is the fallback. #### Tags:
var: | imgPath
see: | var imgName
access: | public
Type: | string
[ Top ] #### $inactiveStyle = 3 [line 96] if a button is set to inactive (status 0), how should that be shown? i don't see a reason to change the default, but still it's possible. = not at all, just leave how it is. = make button gray = fade out button (opacity 0.3) = 1 + 2 (make button gray and face out). this is the default, and it looks good. note: this feature is ie-only, cause only ie offers these filters. sorry. i will try to come up with something for mozilla. if there is no filter-like thing then i'll try it with a semi-transparent gif over the button. #### Tags:
var: | inactiveStyle
since: | bs4.4
see: | this.setStatus(), var this._status
access: | public
Type: | int
[ Top ] #### $title = [line 158] the title (alt text) of your button. note that this.setTitle() also works at runtime, after rendering. #### Tags:
var: | title
see: | this.setTitle()
access: | public
Type: | string
[ Top ] #### $width = [line 139] you can overwrite the width that is specified in the css. #### Tags:
var: | width (in pixel)
see: | var this.height
access: | public
Type: | int
[ Top ] #### $_constructor = [line 739]
Type: | mixed
[ Top ] ### Class Methods ### method attachEvent [line 277]
`void attachEvent( mixed fire, string e)`
attach functions and code that fires on events. these events are available: 'on' = when the button gets clicked 'off' = if it's a toggle-style button and it looses the "on" status 'over' = mouse over 'out' = mouse out registered functions receive one parameter: a reference to 'this', the button object. //registered code string can use the constant __THIS__. it will then be replaced with a //reference to 'this', the button object. example: "doThis('foo', __THIS__);" registered code string can use the word 'this'. it will mean this button object. example: "doThis('foo', this);" #### Tags:
see: | this.attachFireOff()
access: | public
#### Parameters:
mixed | fire | fire (function or string of code that gets evaluated)
string | e | e (event type, default is 'on')
[ Top ] ### method attachFireOff [line 286]
`void attachFireOff( mixed param)`
#### Tags:
todo: | all
[ Top ] ### method dragStart [line 494]
`void dragStart( mixed div)`
[ Top ] ### method drawInto [line 425]
`void drawInto( mixed elm)`
renders this into the element specified. #### Tags:
access: | public
#### Parameters:
mixed | elm | elm (string name of element, or object reference to element)
[ Top ] ### method drawOut [line 414]
`void drawOut( )`
renders this using writeln(). #### Tags:
access: | public
[ Top ] ### method getStatus [line 577]
`int getStatus( )`
returns the status of this button. #### Tags:
since: | bs4.4
see: | var _status, Bs_Button::setStatus()
access: | public
[ Top ] ### method mouseDown [line 462]
`void mouseDown( mixed div)`
[ Top ] ### method mouseOut [line 454]
`void mouseOut( mixed div)`
[ Top ] ### method mouseOver [line 446]
`void mouseOver( mixed div)`
[ Top ] ### method mouseUp [line 467]
`void mouseUp( mixed div)`
[ Top ] ### method numberOfAttachedEvents [line 687]
`int numberOfAttachedEvents( string e)`
returns the number of attached events of the type specified. #### Tags:
return: | (0-n)
see: | Bs_Button::attachEvent(), _fireEvent().
access: | public
#### Parameters:
string | e | eventType ('on', 'off', 'over', 'out')
[ Top ] ### method render [line 294]
`string render( )`
renders this and returns it. #### Tags:
return: | (html code)
access: | public
[ Top ] ### method setChildrenButtonBar [line 602]
`void setChildrenButtonBar( object bar bar)`
sets a children button bar #### Tags:
see: | var _childrenButtonBar
access: | public
#### Parameters:
object bar | bar | (instance of Bs_ButtonBar)
[ Top ] ### method setStatus [line 533]
`void setStatus( int status)`
sets status of the button. like a click, but as api function. does not fire registered functions, like 'on'! #### Tags:
since: | bs4.4
see: | var _status, Bs_Button::getStatus()
access: | public
#### Parameters:
int | status | status (see var _status)
[ Top ] ### method setTitle [line 589]
`void setTitle( mixed title)`
sets the title, also works at runtime. #### Tags:
var: | title
since: | bs4.4
see: | var this.title
access: | public
[ Top ] ### method _getId [line 694]
`void _getId( )`
[ Top ] Documentation generated on Mon, 29 Dec 2003 22:18:14 +0100 by phpDocumentor 1.2.3