04.08.2013 Views

Printing - FoxTalk - dFPUG-Portal

Printing - FoxTalk - dFPUG-Portal

Printing - FoxTalk - dFPUG-Portal

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Passing the name of a registered add-in to the DoAddIn() method will run that add-in.<br />

You can also call the add-in with the add-in button. Clicking on the add-in button activates a<br />

menu with the installed add-ins. The same menu can be expanded manually with the<br />

AddInMenu() method as follows:<br />

_oBrowser.AddInMenu()<br />

Running this method will expand the menu at the location of the mouse pointer. You can close<br />

the menu with _oBrowser.DeactivateMenu(), although you shouldn't need to because the menu is<br />

automatically closed when a selection is made.<br />

Unregistering an add-in<br />

You can also remove an add-in from the Browser Registration table with the AddIn() method:<br />

_oBrowser.AddIn("Class Name",.NULL.)<br />

If the program name is provided as a value of .NULL., the add-in record in the browser<br />

registration table is marked for deletion.<br />

Creating custom add-ins<br />

Add-ins let you control many events and extend or override existing behavior. The previous<br />

example is a trivial one that simply displays the name of the currently selected class. It<br />

accomplishes this by accepting the object parameter (remember, the Class Browser form object<br />

is the parameter) and then accessing the Class Browser's cClass property in the WAIT<br />

WINDOW command.<br />

While this example isn't particularly useful, it does illustrate a few key concepts. First, by<br />

sending itself as the parameter to the add-ins, every add-in has access to the full power of the<br />

Class Browser. That's why it's so important to take the time to learn about the objects, properties,<br />

events, and methods of the Class Browser (they're all documented in the Visual FoxPro help<br />

file). Another key point here is that there isn't much that an add-in can't do for you.<br />

Here's another example of an add-in: This one inserts additional header information to the code<br />

exported with the Class Browser's ExportClass() method. It's useful when you have to represent<br />

a class in code. You may need to do this for system documentation, when writing articles or<br />

books, and so forth:

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

Saved successfully!

Ooh no, something went wrong!