Partilhar via


Class Browser Methods

The following methods are associated with the Class Browser.

AddClass( )

Copies a class from one class library (.vcx) file to another. Used after a drag-and-drop operation between instances of the Class Browser and dependent on the oSource property. If the specified class does not exist, a class is created.

AddFile( )

AddFile([cFileName][, lIgnoreRefresh])

Adds a class library (.vcx) or form (.scx) file to the Class Browser class list. If no parameters are passed, an AddFile dialog box appears by using the Class Browser GetFile( ) method. If lIgnoreRefresh is True (.T.), the Class Browser class list is not refreshed. If you are adding multiple files, you can wait until all classes are added before refreshing the list.

AddIn( )

AddIn(cName[, cProgram] [, cMethod] [, cFileFilter] [, cPlatform]
[, cComment])

Installs or removes the specified add-in to the Browser.dbf registration table.

Parameters

  • cName Specifies the name of the add-in. Not case-sensitive; however, when displayed on a menu, the value appears as entered.

  • cProgram Specifies the name of a program (.PRG), form (.scx), application (.APP), executable file (.EXE), or compiled program (.FXP) to run. If no extension is provided, the extension .PRG is assumed.

    **Note   **If this argument is .NULL., the add-in is marked for deletion in Browser.dbf and disabled in the add-in shortcut menu.

  • cMethod Specifies a method name to use as an event hook. If empty, the add-in appears on the menu.

  • cFileFilter Specifies a list of class libraries and forms that enable the add-in. If empty, the add-in is available for all class libraries (.vcx) and forms (.scx).

  • cPlatform Specifies the platform the add-in is available on. If empty, the add-in is available on all platforms supported by Visual FoxPro.

  • cComment Specifies text stored in a memo field in the Browser.dbf.

AddInMenu( )

Expands the menu that displays the registered add-ins.

AddInMethod( )

AddInMethod(cObjMethod)

Executes any registered add-in for the specified object method.

Example: To change the default behavior of the Help button in the Class Browser, use the following code:

_OBROWSER.AddInMethod("cmdHelp.click")

AutoRefresh( )

Determines whether to refresh the display by checking for updated class library (.vcx) information in the selected class in the class list, and by checking the total number of records in the class library (.vcx) file being edited. This method runs when the Class Browser form is activated.

BinToInt( )

BinToInt([cBinaryValue])

Returns the integer equivalent of a string representing a binary value. For example, passing this method a cBinaryValue of "11001" would return 25.

CleanUpFile( )

Removes records from the class library (.vcx) file associated with the selected class in the class list.

ClearBrowser( )

Internal use only.

ClearClass( )

ClearClass([lClearAll])

Clears the class cache from memory with the CLEAR CLASS command for a specific class, or all classes displayed if lClearAll is set to True (.T.).

NewClass( )

Creates a subclass of the selected class in the class list.

DeactivateMenu( )

Deactivates the add-in popup menu.

DisplayMenu( )

DisplayMenu(tnMenuMode)

Displays the shortcut menu at the current mouse pointer location. If tnMenuMode is 0, the Class Browser form shortcut menu is displayed; if 1, the Class list shortcut menu; if 2, the Member list shortcut menu.

DoAddIn( )

DoAddIn([cAddInName])

Executes the specified add-in of the current or specific record of the table with the BROWSER alias.

FileMatch( )

FileMatch(cFileName, cFileList)

Compares the specified file against the specified file list to determine if the file is one associated with the add-in.

ExportClass( )

ExportClass([lShow] [, tcExportToFileName])

Generates and displays the definition source code of the selected class or the selected file in the class list.

Parameters

  • lShow Specifies whether to display the code. If the parameter lShow is True (.T.), the Class Browser window displays the code.
  • tcExportToFileName Specifies the name of the file to receive the code.

FindClass( )

FindClass([cFind])

Finds class text within a class.

FormAddObject( )

FormAddObject(oObject [, nXCoord] [, nYCoord] [, lActivateForm] 
[, lDesignMode][, lNoShow] [, lNoErrors] [, lBuilder] [, oForm])

Adds an instance of the selected class in the class list to an external form.

Parameters

  • oObject Specifies a reference to the destination container. The values can be either "command" for the Command window, "screen" for the Visual FoxPro desktop, or "new". You can implement these options with the following commands:

    _oBrowser.FormAddObject("command")
    _oBrowser.FormAddObject("-screen")
    _oBrowser.FormAddObject("new")
    
  • nXCoord Specifies the horizontal position of the object inside the container. If no value is passed, the current mouse position is used.

  • nYCoord Specifies the vertical position of the object inside the container. If no value is passed, the current mouse position is used.

  • lActivateForm If True (.T.), the destination form is activated when the object is added to it; if False (.F.), the Class Browser remains active.

  • lDesignMode If True (.T.), the object reference is an object currently in the Form Designer or class designer.

  • lNoShow If True (.T.), the object reference is an object currently in the Form Designer or class designer.

  • lNoErrors Specifies whether errors generated at instantiation are ignored. If False (.F.), errors are displayed in the Class Browser.

  • lBuilder Specifies**whether a custom builder is launched after the object is added to a container.

  • oForm Specifies**the container to which an object is added. oForm, an optional parameter,**is primarily used to contain the host object in design mode.

FormatMethods( )

FormatMethods(cMethods)

Formats the text of generated methods in the display of the class definition code.

FormatProperties( )

FormatProperties(cProperties [, lAddObjectMode])

Formats the text of generated properties in the display of the class definition source code.

GetFile( )

GetFile([cFileExt])

Opens the Class Browser GetFile( ) dialog box. The GetFile( ) method is used internally by the Open or Add buttons in the Class Browser. Whenever the Class Browser prompts for a class library (.vcx) or form (.scx), the GetFile( ) method is called internally.

GetTimeStamp( )

GetTimeStamp([ntimestamp])

Returns the character equivalent of a timestamp value. If no parameter is passed, returns the timestamp string of the currently selected file.

IndentText( )

IndentText(cCode)

Indents a block of text one tab.

IntToBin( )

IntToBin([nInteger])

Returns a string representing a binary value that is the equivalent of an integer value. For example, passing this method a nInteger of 25 would return "11001".

ModifyClass( )

Opens the selected class in the Class Designer.

MsgBox( )

MsgBox(cMessage [, nType] [, cTitle])

Displays the Class Browser message box. Similar to the Visual FoxPro MESSAGEBOX( ) function.

NewFile( )

NewFile([cFileName] [, lOpenFile])

Creates a new class library (.vcx) file. If no parameters are passed, the Open dialog box is displayed. If parameters are provided, a new class library (.vcx) is created and added to the class list in Class Browser.

OpenFile( )

OpenFile([cFileName])

Opens an existing class library (.vcx) or form (.scx) file. If a file name is not provided, the Open dialog box appears.

ProperBaseClass( )

ProperBaseClass(cBaseClass)

Returns the base class name in the proper case. For example, "combobox" would return as "ComboBox".

RedefineClass( )

RedefineClass([cAsClass] [, cClassLoc])

Changes the parent class of the selected class in the class list.

RefreshButtons( )

Refreshes the Class Browser command buttons based on the file type.

RefreshClassIcon( )

Reloads the class icon from the icon file.

RefreshClassList( )

RefreshClassList([cDefaultClass] [, lIgnoreTable])

Refreshes the class list.

RefreshClassListSubclass( )

For internal use only.

RefreshFileAttrib( )

Refreshes the file attribute status of the file name associated with the selected class in the class list.

RefreshCaption( )

Refreshes the Class Browser caption of a form.

RefreshDescriptions( )

Internal use only. Refreshes the descriptions of classes and members.

RefreshMembers( )

RefreshMembers([tcDefaultMember])

Refreshes the Member tabs to display information associated with the selected class in the class list and, if provided, the specified member.

RefreshParentClassBrowser( )

Refreshes the state of the ParentClass Browser toolbar.

RefreshPrefRecNo( )

Refreshes the Browser.dbf preference record pointer for the class library (.vcx) or form (.scx) file being edited.

RefreshRecNo( )

Refreshes the current record pointer of the class library (.vcx) or form (.scx) table for the file of the selected class.

RemoveClass( )

RemoveClass([lConfirm])

Removes the selected class in the class list from its associated class library (.vcx) file.

RenameClass( )

RenameClass([cToClass])

Changes the class name of the selected class in the class list.

ResetDefaults( )

Restores original display settings. This method is called when you choose Restore Defaults from the shortcut menu.

SavePreferences( )

Saves current preference settings to the Browser.dbf registration table.

ScaleResize( )

Scales the controls on the Class Browser form to fit after the form is resized using the Resize( ) event.

SeekClass( )

SeekClass([cClass][, cClassLibrary])

Moves the class list pointer to a specific class or index in the class list. Can use the numeric value of the visual position in the class list.

SeekMember( )

SeekMember(tcMember)

Moves the member list pointer to a specific member.

SeekParentClass( )

Displays the parent class of the selected class in the class list.

SetBusyState( )

SetBusyState(lBusyState)

Sets the lBusyStatus property to True (.T.) or False (.F.) based on the parameter received; also sets the mouse pointer shape to an arrow or hourglass.

SetFont( )

SetFont([cFontName][, nFontSize][, lFontBold][, lFontItalic])

Sets the font and font size used by the Class Browser for its form, controls, and dialog boxes. If you don't specify a font name or size, SetFont( ) opens the Get Font dialog box.

ShowMenu( )

ShowMenu(aMenu[, cOnSelection])

Displays a menu based on an array. If a menu is a single-dimension array, this method displays a list of all items in your menu. If the array is two-dimensional with an item and an action, it displays the menu items and when the item is selected, it executes the associated action.

TrimExt( )

TrimExt(cFileName [, lPlatformType])

Truncates the file name extension.

TrimFile( )

TrimFile(cFileName [, lPlatformType])

Truncates the file name and returns only the file name and path.

TrimPath( )

TrimPath(cFileName [, lTrimExt] [, lPlatformType])

Truncates the path name.

UpdateReferences( )

UpdateReferences(tcOldClassLoc, tcOldClass, tcNewClassLoc, tcNewClass 
[, tlAllInstances])

Used to update references of classes (subclasses and object members) when renaming a class and when moving a class from one class browser to another.

Parameters

  • tcOldClassLoc Specifies the original contents of the ClassLoc field in the .vcx or .scx file.
  • tcOldClass Specifies the original contents of the Class field in the .vcx or .scx file.
  • tcNewClassLoc Specifies the new contents of the ClassLoc field in the .vcx or .scx file..
  • tcNewClass Specifies the new contents of the Class field in the .vcx or .scx file.
  • tlAllInstances If True (.T.) all files in all Class Browser windows are updated. If False (.F.) only the files in the current Class Browser window are updated.

VersionCheck( )

VersionCheck([lShowErrorMsg])

Validates the open class library (.vcx) or form (.scx) file.

ViewProperty( )

ViewProperty(cProperty)

Displays the value of a specific property of the selected class.

WildcardMatch( )

WildcardMatch(cMatchExpList, cExpressionSearched)

Compares strings for a wildcard match with the filters specified in the Type box.

See Also

Browsing Classes with the Class Browser | Class Browser Buttons | Class Browser Methods | Class Browser Object Members | Class Browser Properties | Class Browser Window | Customizing the Class Browser | Initial Values of Class Browser Properties