home *** CD-ROM | disk | FTP | other *** search
- //<script>
- //****************************************************************
- // ⌐2000 Microsoft Corporation. All rights reserved.
- //****************************************************************
- //
- // JScript Checkbox Object
- //
- // This object allows for a windows media player skin to "simulate"
- // a checkbox using text controls
- //****************************************************************
-
-
-
- //****************************************************************
- //****************************************************************
- //
- // checkbox object
- //
- //****************************************************************
- //****************************************************************
-
- function checkbox( check_text, check_label_text,
- onValueChange,
- fInitialValue )
- {
- // Controls
-
- this.check_text = check_text;
- this.check_label_text = check_label_text;
-
- // Public data
-
- this.fChecked = fInitialValue;
-
- // Public methods
-
- this.onMouseDownCB = onMouseDownCB;
- this.onKeyPressCB = onKeyPressCB;
- this.setCheckedCB = setCheckedCB;
-
- // Public Events
-
- this.onValueChange = onValueChange;
-
- // Initialization Code
-
- this.check_text.fontFace = "wingdings";
- this.check_text.value = String.fromCharCode( this.fChecked ? 0x00FE : 0x00A8 )
- this.check_text.fontSize = this.check_label_text.fontSize + 1;
- this.check_text.left = this.check_label_text.left - this.check_text.textWidth - 4;
- this.check_text.top = this.check_label_text.top;
- this.check_text.fontStyle = "bold";
- this.check_text.cursor = "hand";
- this.check_text.foregroundColor = this.check_label_text.foregroundColor;
- this.check_label_text.cursor = "hand";
- }
-
-
-
-
- //****************************************************************
- // XML Callbacks
- //****************************************************************
-
- //****************************************************************
- // This function is called when the mouse goes down over either
- // text control
-
- function onMouseDownCB()
- {
- if (event.button == 1)
- {
- this.setCheckedCB( !this.fChecked );
- }
- }
-
- //****************************************************************
-
- function onKeyPressCB()
- {
- if (event.keyCode == 32)
- {
- this.setCheckedCB( !this.fChecked );
- }
- }
-
- //****************************************************************
-
- function setCheckedCB( checked )
- {
- if (this.fChecked != checked)
- {
- this.fChecked = checked;
- this.check_text.value = String.fromCharCode( this.fChecked ? 0x00FE : 0x00A8 )
-
- if (this.onValueChange)
- {
- this.onValueChange();
- }
- }
- }
-