| javascript_components

# Class: Bs_NumberField Source Location: /components/numberfield/Bs_NumberField.class.js.php
### Class Overview
Text field for numbers. #### Author(s): andrej arn <at blueshoes dot org> #### Copyright: blueshoes.org | ### Variables Bs_NumberField:: $buttonDown $buttonUp $drawButtonsInside $maxValue $minValue $zeroFill $_constructor $_elementId $_elm $_value | ### Methods attachEvent decrease draw fireEvent fixValue getValue hasEventAttached increase isValidValue onBlur onClickButtonDown onClickButtonUp onFocus onKeyDown onKeyUp onWheel redraw render setValue toggleButtonDisplay updateByField
### Inherited Variables | ### Inherited Methods
### Class Details [line 52] Text field for numbers. currently only full numbers (integers) are supported. dependencies: /core/lang/Bs_Misc.lib.js /components/toolbar/Bs_Button.class.js #### Tags:
copyright: | blueshoes.org
author: | andrej arn <at blueshoes dot org>
[ Top ] ### Class Variables #### = arguments [line 55]
Type: | mixed
[ Top ] #### $buttonDown = [line 90] #### Tags:
access: | public
Type: | object buttonDown
[ Top ] #### $buttonUp = [line 84] #### Tags:
access: | public
Type: | object buttonUp
[ Top ] #### $drawButtonsInside = false [line 97] #### Tags:
var: | drawButtonsInside
status: | experimental
access: | public
Type: | bool
[ Top ] #### $maxValue = [line 68]
Type: | mixed
[ Top ] #### $minValue = 0 [line 69]
Type: | mixed
[ Top ] #### $zeroFill = [line 78] if the number should be zerofilled. example: zeroFill 3 means a value of 5 looks like 005. #### Tags:
var: | zeroFill
access: | public
Type: | int
[ Top ] #### $_constructor = [line 591]
Type: | mixed
[ Top ] #### $_elementId = (a.length>1) ? a[1] : a[0] [line 56]
Type: | mixed
[ Top ] #### $_elm = document.getElementById(this._elementId) [line 57]
Type: | mixed
[ Top ] #### $_value = 0 [line 70]
Type: | mixed
[ Top ] ### Class Methods ### method attachEvent [line 546]
`void attachEvent( string trigger, mixed yourEvent)`
attaches an event. the following triggers can be used: 'onBeforeChange' 'onAfterChange' the onXXXChange events fire when the wheel is used, a button (up/down) is clicked, cursor up or down is pushed. but they do NOT fire when you use the api methods setValue(), increase() and decrease(). because then you already know what's happening. the events will be executed in the order they were registered. if an onBeforeXXX event you've attached returns bool FALSE, it will stop executing any other attached events in that queue, and it will quit. example: if you attach an onBeforeChange event, and your code returns FALSE, the change won't be done at all. examples: myObj.attachEvent('onBeforeChange', myFunction); then your function myFunction() receives one param, it is a reference to this object (myObj). myObj.attachEvent('onBeforeChange', "if (true) return false;"); this is an example with code attached that will be evaluated. #### Tags:
see: | var this._attachedEvents
access: | public
#### Parameters:
string | trigger | trigger
mixed | yourEvent | yourEvent (string (of code) or function)
[ Top ] ### method decrease [line 207]
`void decrease( )`
decreases the value by 1. #### Tags:
access: | public
[ Top ] ### method draw [line 299]
`? draw( )`
[ Top ] ### method fireEvent [line 574]
`true fireEvent( string trigger)`
fires the events for the trigger specified. #### Parameters:
string | trigger | trigger
[ Top ] ### method fixValue [line 354]
`int fixValue( mixed value)`
checks min and max size etc and returns the 'clean' value. if we don't have a valid number, then this.minValue is returned. if that is not available either, then 0 is returned. #### Tags:
return: | (or string if zerofilled)
access: | public
#### Parameters:
mixed | value | value
[ Top ] ### method getValue [line 187]
`int getValue( )`
returns the current value. #### Tags:
access: | public
[ Top ] ### method hasEventAttached [line 564]
`bool hasEventAttached( string trigger)`
tells if any event is attached for the trigger specified. #### Tags:
access: | public
#### Parameters:
string | trigger | trigger
[ Top ] ### method increase [line 197]
`void increase( )`
increases the value by 1. #### Tags:
access: | public
[ Top ] ### method isValidValue [line 387]
`bool isValidValue( mixed value)`
tells if the value specified is valid, and in the desired range. #### Tags:
access: | public
#### Parameters:
mixed | value | value
[ Top ] ### method onBlur [line 480]
`void onBlur( )`
[ Top ] ### method onClickButtonDown [line 448]
`void onClickButtonDown( )`
fires when the 'up-botton' is clicked. [ Top ] ### method onClickButtonUp [line 437]
`void onClickButtonUp( )`
fires when the 'up-botton' is clicked. [ Top ] ### method onFocus [line 458]
`void onFocus( )`
[ Top ] ### method onKeyDown [line 397]
`void onKeyDown( )`
[ Top ] ### method onKeyUp [line 421]
`void onKeyUp( )`
[ Top ] ### method onWheel [line 467]
`void onWheel( )`
[ Top ] ### method redraw [line 273]
`void redraw( )`
redraws the buttons. if your number field was in an invisible area while draw() was called (for example in a div that had display:none) then you'll need to call this method once your div becomes visible. this is because the browser does not tell us the right measurements if display is set to none. also other changes like a window resize require this method. #### Tags:
access: | public
[ Top ] ### method render [line 216]
`? render( )`
[ Top ] ### method setValue [line 176]
`void setValue( mixed value)`
sets a new value. #### Tags:
access: | public
#### Parameters:
mixed | value | value
[ Top ] ### method toggleButtonDisplay [line 505]
`void toggleButtonDisplay( bool show)`
shows or hides the up-down buttons. #### Tags:
access: | public
#### Parameters:
bool | show | show (true = display, false = hide)
[ Top ] ### method updateByField [line 489]
`bool updateByField( )`
updates everything based on the current value in the field. #### Tags:
return: | (true if there was a change, false if not)
access: | public
[ Top ] Documentation generated on Mon, 29 Dec 2003 22:18:26 +0100 by phpDocumentor 1.2.3