Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need code to run a ((run)method(tab)) from a pushbutton 1

Status
Not open for further replies.

elevator

Programmer
Apr 23, 2002
19
US
I have this run method, that does not seem to function
from my pushButton. I am sort of confused. I would think that there is some code that would tell the method to run when I push the button on the form. Please help.
 
We need more information. I am assuming you placed it in the pushButton method of the button, so how about posting the code and what it's supposed to do so we can take a look.


Mac :)

"Strange women lying in ponds and distributing swords is no basis for a system of government" - Dennis, age 37

mailto:langley_mckelvy@cd4.co.harris.tx.us
 
elevator,

Run() methods are usually the main routine in scripts. IF you have the run method itself, then you'll want to copy that to the Clipbaord, create a new script in Paradox, and then paste your code into the run method of the script (which is automatically created for you).

Use care to not duplicate the first and last lines of the method, e.g:

Code:
method run(var eventInfo Event)
  ; your code goes here...
endMethod

Now, if you have problems running that, then you may need to troubleshoot the code in question. Here are a few tips:

1. Make sure you're seeing all the tools available to you. To do this, go to the General tab of the Developer Preferences dialog (yypically invoked using Tools | Settings | Developer Preferences). Set ObjectPAL Level to Advanced, check the enable debug() statement under Debugger settings, and check the Show Developer menus option. Choose OK to save these changes.

2. You will design a form, script, or library, you will now see a Program item in the main menu, which contains a couple of useful troubleshooting options. With your script open, choose Program | Compiler Warnings and Program | Compile with Debug. Note that these are flags that control the way Paradox saves your files that contain code.

These settings will a) display all errors (not just critical ones) using dialog boxes and b) provide more information, including the line number, about the problem.

Please note that you need to save your file for these new settings to take effect.

Now, if you have a script and are having problems executing it from a form, you'll want to place a button on the form, open its pushButton() event, and then add something like this:

Code:
play "myscript"

If nothing happens, then it's possible that there's a problem. If it's a major problem (at least as far as Paradox is concerned, an error dialog will appear with details. However, Paradox displays certain errors in the status line, which is pretty easy to lose track of--especially if you use the mouse heavily.

In that case, change your pushButton code to something like:

Code:
errorTrapOnWarnings( Yes ) 
play "myscript"

Run the form and then click the button. Yes, this will trigger the same problem, however, you'll now see the error dialog on all errors, not just the ones that Paradox can ignore.

In most cases like the the dialog will say something like "The design object could not be opened" (if you've set the Program menu settings listed earlier, you'll get the line where the error was encountered and a bit of code on that line). IF this is the error you're seeing, take note of the second button on the dialog, specifically the
Code:
>>
button.

This is enabled whenever there's more information available. Get into the habit of looking for this whenever you see error dialogs, for it frequently leads you to the most relevant information about the specific problem. In this case, clicking it leads to a message saying "Cannot find myscript." (which is Paradox's way of saying, "File not found").

Now, that's the basics. If that doesn't help, then feel free to follow-up with the additional information you learn from the process.

Hope this helps...

-- Lance
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top