umaandsusan,
While Mac is technically correct in that the view() method is the easiest, it's not terribly flexible. For example, there's no way to know if the user clicked the OK button or the Cancel button from the resulting dialog.
The way it's supposed to work is:
1. Create a blank form that looks like a dialog box.
2. Place a field object on the form that let's the user enther the value(s) you need. Be sure to give this object a name that makes sense, e.g. fldInput.
3. Place an OK button on your dialog form that has the following in its pushButton() event:
4. Place a Cancel button on the dialog form that adds the following to its pushButton() event:
5. Save your dialog form and give it a name you'll remember. In this example, we'll assume it's called MYDIALOG.FSL.
6. Add code to your script that loads the form, waits for the user to deal with it, and then responds appropriately. For example:
Code:
var
fmDialog Form
strValue String
endVar
if not fmDialog.open( "MyDialog" ) then
errorStop( "Can't Open Dialog",
"Use [>>] for more details..." )
else
fmDialog.fldInput = "<A Default Value">
if fmDialog.wait() = TRUE then
strValue = fmDialog.fldInput.Value
doSomething()
else
Message( "Cancelled, as requested..." )
endIf
try
fmDialog.close()
onFail
; do nothing it's already closed
endTry
endIf
Nowq, I know this feels like a lot of work, but there are a number of things that can go wrong and this provides a good starting place for handling those--and other--issues.
Hope this helps...
-- Lance
P.S. While this is a good starting place, it's not what Paul Harvey might call "the rest of the story." For best results, you'll want to make certain your dialog form only uses one of two exits. See
for details.