04.08.2013 Views

Printing - FoxTalk - dFPUG-Portal

Printing - FoxTalk - dFPUG-Portal

Printing - FoxTalk - dFPUG-Portal

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Sometimes an add-in most appropriately enhances or replaces existing functionality in the Class<br />

Browser. For example, the DocumentClass add-in can be viewed as analogous to the View Class<br />

command button. You could say it would be appropriate to hook this add-in not to the add-in<br />

menu but rather to the RightClick event of the View Class button.<br />

To show how this is done, let's take a closer look at the syntax of the AddIn() method:<br />

AddIn(, ;<br />

, ;<br />

, ;<br />

, ;<br />

, ;<br />

)<br />

is the name of the add-in. The name can be one or more words and case isn't<br />

important except that it will display on the menu in the same manner as you specify here. The<br />

add-in will display in the add-in menu if the third parameter (Method Name) isn't specified.<br />

is the name of a program to run. The program can be a .PRG, .APP, .EXE, or<br />

.FXP. In addition, you can specify an .SCX. The assumed extension is .PRG; specify other<br />

extensions as appropriate.<br />

can also be the name of an object. The syntax for this would be , for example:<br />

_oBrowser.AddIn("MyAddIn", "MyVcx.VCX, MyClass")<br />

When the add-in is run, the class MyClass of MyVcx.VCX is instantiated. Remember that an<br />

object parameter will be sent through to the class.<br />

It's a good idea to specify a full path to the program in this parameter, ensuring that the add-in<br />

runs properly wherever you are in your hard disk. If the Class Browser can't find the program or<br />

.VCX when trying to call an add-in, an error will be generated.<br />

is the name of a method to automatically call the add-in. Any valid method,<br />

either a method of the Class Browser form or one of its objects, can be a hook for a method. For<br />

example, if you want to hook MyAddIn to the Export CommandButton's RightClick event, you<br />

can use the following code:<br />

_oBrowser.AddIn("MyAddIn", , "CmdExport.Click")<br />

By the way, you don't have to specify the second parameter in this command. This allows you to<br />

change the registration of an add-in only as much as you need. In this case, since the program<br />

that will run when MyAddIn is run doesn't change, there's no need to specify that parameter.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!