Garry Christensen
2004-02-15 23:43:10 UTC
I don't know if this has been reported. I have a form that is instantiated
at the beginning of an app but only opened as I need it. It has an OK
button set as Default. I use it modal, opening it with readmodal().
I can press enter and the OK button fires, then closes the form. I can open
it again and repeat this as many times as I like. If I tab to the OK button
and press enter, the form closes as it should but on all subsequent uses,
the button refuses to respond to the Enter key, either as default or when it
has focus.
Here's a demo:
Run it the first time to instantiate it and press Enter to close it.
Run it again and tab to the button and press Enter.
Run it again and try to close it by pressing Enter. The button no longer
responds.
(watch for wordwrap)
************************************
if type('_app.PushbuttonDefault') = 'U'
_app.PushbuttonDefault = new pushbuttonDefaultForm()
endif
_app.PushbuttonDefault.readModal()
if _app.PushbuttonDefault.OpenCount = 3
_app.PushbuttonDefault = null
endif
**************************************
class pushbuttonDefaultForm of FORM
with (this)
onOpen = class::FORM_ONOPEN
height = 4
width = 75
mdi = false
endwith
this.ENTRYFIELD1 = new ENTRYFIELD(this)
with (this.ENTRYFIELD1)
height = 1
left = 1.
top = 0.4
width = 72
endwith
this.PUSHBUTTON1 = new PUSHBUTTON(this)
with (this.PUSHBUTTON1)
onClick = {;form.close()}
height = 1
left = 26
top = 2
width = 15
text = "Close"
default = true
endwith
function form_onOpen
do case
case type('form.OpenCount') = 'U'
form.OpenCount = 1
form.entryfield1.value = 'Press ENTER to fire default pustbutton.'
case form.OpenCount = 1
form.OpenCount = 2
form.entryfield1.value = 'Now press TAB then ENTER.'
case form.OpenCount = 2
form.OpenCount = 3
form.entryfield1.value = 'Press ENTER to fire default pustbutton. Event
will not fire. Nor will TAB and ENTER.'
endcase
form.entryfield1.setFocus()
return
endclass
at the beginning of an app but only opened as I need it. It has an OK
button set as Default. I use it modal, opening it with readmodal().
I can press enter and the OK button fires, then closes the form. I can open
it again and repeat this as many times as I like. If I tab to the OK button
and press enter, the form closes as it should but on all subsequent uses,
the button refuses to respond to the Enter key, either as default or when it
has focus.
Here's a demo:
Run it the first time to instantiate it and press Enter to close it.
Run it again and tab to the button and press Enter.
Run it again and try to close it by pressing Enter. The button no longer
responds.
(watch for wordwrap)
************************************
if type('_app.PushbuttonDefault') = 'U'
_app.PushbuttonDefault = new pushbuttonDefaultForm()
endif
_app.PushbuttonDefault.readModal()
if _app.PushbuttonDefault.OpenCount = 3
_app.PushbuttonDefault = null
endif
**************************************
class pushbuttonDefaultForm of FORM
with (this)
onOpen = class::FORM_ONOPEN
height = 4
width = 75
mdi = false
endwith
this.ENTRYFIELD1 = new ENTRYFIELD(this)
with (this.ENTRYFIELD1)
height = 1
left = 1.
top = 0.4
width = 72
endwith
this.PUSHBUTTON1 = new PUSHBUTTON(this)
with (this.PUSHBUTTON1)
onClick = {;form.close()}
height = 1
left = 26
top = 2
width = 15
text = "Close"
default = true
endwith
function form_onOpen
do case
case type('form.OpenCount') = 'U'
form.OpenCount = 1
form.entryfield1.value = 'Press ENTER to fire default pustbutton.'
case form.OpenCount = 1
form.OpenCount = 2
form.entryfield1.value = 'Now press TAB then ENTER.'
case form.OpenCount = 2
form.OpenCount = 3
form.entryfield1.value = 'Press ENTER to fire default pustbutton. Event
will not fire. Nor will TAB and ENTER.'
endcase
form.entryfield1.setFocus()
return
endclass