1 ////////////////////////////////////////////////////
2 // controlWindow object
3 ////////////////////////////////////////////////////
4 function controlWindow( controlForm
) {
6 this._form
= controlForm
;
9 this.windowType
= "controlWindow";
10 this.noSuggestionSelection
= "- No suggestions -";
11 // set up the properties for elements of the given control form
12 this.suggestionList
= this._form
.sugg
;
13 this.evaluatedText
= this._form
.misword
;
14 this.replacementText
= this._form
.txtsugg
;
15 this.undoButton
= this._form
.btnUndo
;
18 this.addSuggestion
= addSuggestion
;
19 this.clearSuggestions
= clearSuggestions
;
20 this.selectDefaultSuggestion
= selectDefaultSuggestion
;
21 this.resetForm
= resetForm
;
22 this.setSuggestedText
= setSuggestedText
;
23 this.enableUndo
= enableUndo
;
24 this.disableUndo
= disableUndo
;
27 function resetForm() {
33 function setSuggestedText() {
34 var slct
= this.suggestionList
;
35 var txt
= this.replacementText
;
37 if( (slct
.options
[0].text
) && slct
.options
[0].text
!= this.noSuggestionSelection
) {
38 str
= slct
.options
[slct
.selectedIndex
].text
;
43 function selectDefaultSuggestion() {
44 var slct
= this.suggestionList
;
45 var txt
= this.replacementText
;
46 if( slct
.options
.length
== 0 ) {
47 this.addSuggestion( this.noSuggestionSelection
);
49 slct
.options
[0].selected
= true;
51 this.setSuggestedText();
54 function addSuggestion( sugg_text
) {
55 var slct
= this.suggestionList
;
57 var i
= slct
.options
.length
;
58 var newOption
= new Option( sugg_text
, 'sugg_text'+i
);
59 slct
.options
[i
] = newOption
;
63 function clearSuggestions() {
64 var slct
= this.suggestionList
;
65 for( var j
= slct
.length
- 1; j
> -1; j
-- ) {
66 if( slct
.options
[j
] ) {
67 slct
.options
[j
] = null;
72 function enableUndo() {
73 if( this.undoButton
) {
74 if( this.undoButton
.disabled
== true ) {
75 this.undoButton
.disabled
= false;
80 function disableUndo() {
81 if( this.undoButton
) {
82 if( this.undoButton
.disabled
== false ) {
83 this.undoButton
.disabled
= true;