What is being left in a field after hitting return
Posted: Mon Mar 01, 2010 3:19 am
Hello All,
I’m running into something odd and I hope someone else has encountered this so you can tell me what I’m doing wrong. Hopefully before I go completely nuts.
First here’s what I’m doing:
From a dropdown menu, built with the menu builder with the standard switch structure, I’m executing a script that runs a VB script. The VB script requires a numeric entry to run correctly. I’m gathering this value from a sub-stack window that is opened as modal from the menu script. On the sub-stack window I have a field and 2 buttons. The field is where the numeric entry comes from. What I want is for the user to either press the OK button or the return key to confirm the numeric entry and execute the script. Here’s the odd part. If the field is empty and I hit the return key everything is fine and the beep is heard. However, if I hit the return key again the script executes with an error in the VB script. It seems to be leaving something in the field. But, if I hit the backspace key before hitting the return key the second time I again get the beep. What is being left in the field when I press the return key?
Tom
This is the OK button script.
global gRowCount – value used in the VB script
ON mouseUp
IF field "Number of rows" is empty THEN
put empty into field "Number of rows"
put empty into gRowCount
beep
ELSE
put field "Number of rows" into gRowCount
put empty into field "Number of rows"
close this window
END IF
END mouseUp
This is the card script. The only card in the sub-stack
global gRowCount
ON preOpenCard
put empty into gRowCount
put empty into field "Number of Rows"
focus field "Number of rows"
pass preOpenCard
END preOpenCard
This is the field script
global gRowCount
ON keyDown tKey
delete the selectedtext
IF tKey is an integer THEN pass keydown – only allows numbers to be entered
beep
END keyDown
ON enterInField
returnInField
pass enterInField
END enterInField
ON returnInField
send mouseUp to button "OK"
pass returnInField
END returnInField
I’m running into something odd and I hope someone else has encountered this so you can tell me what I’m doing wrong. Hopefully before I go completely nuts.
First here’s what I’m doing:
From a dropdown menu, built with the menu builder with the standard switch structure, I’m executing a script that runs a VB script. The VB script requires a numeric entry to run correctly. I’m gathering this value from a sub-stack window that is opened as modal from the menu script. On the sub-stack window I have a field and 2 buttons. The field is where the numeric entry comes from. What I want is for the user to either press the OK button or the return key to confirm the numeric entry and execute the script. Here’s the odd part. If the field is empty and I hit the return key everything is fine and the beep is heard. However, if I hit the return key again the script executes with an error in the VB script. It seems to be leaving something in the field. But, if I hit the backspace key before hitting the return key the second time I again get the beep. What is being left in the field when I press the return key?
Tom
This is the OK button script.
global gRowCount – value used in the VB script
ON mouseUp
IF field "Number of rows" is empty THEN
put empty into field "Number of rows"
put empty into gRowCount
beep
ELSE
put field "Number of rows" into gRowCount
put empty into field "Number of rows"
close this window
END IF
END mouseUp
This is the card script. The only card in the sub-stack
global gRowCount
ON preOpenCard
put empty into gRowCount
put empty into field "Number of Rows"
focus field "Number of rows"
pass preOpenCard
END preOpenCard
This is the field script
global gRowCount
ON keyDown tKey
delete the selectedtext
IF tKey is an integer THEN pass keydown – only allows numbers to be entered
beep
END keyDown
ON enterInField
returnInField
pass enterInField
END enterInField
ON returnInField
send mouseUp to button "OK"
pass returnInField
END returnInField