Condividi tramite


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( )
    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.
AddFile([cFileName][, lIgnoreRefresh])
  • AddIn( )
    Installs or removes the specified add-in to the Browser.dbf registration table.
AddIn(cName[, cProgram] [, cMethod] [, cFileFilter] [, cPlatform]
[, cComment])

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. If a specific class library (.vcx) and a name for a new class are provided, a new class is created in the library.

    **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( )
    Executes any registered add-in for the specified object method.
AddInMethod(cObjMethod)

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( )
    Returns the integer equivalent of a string representing a binary value. For example, passing this method a cBinaryValue of "11001" would return 25.
BinToInt([cBinaryValue])
  • CleanUpFile( )
    Removes records from the class library (.vcx) file associated with the selected class in the class list.
  • ClearBrowser( )
    Internal use only.
  • ClearClass( )
    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.).
ClearClass([lClearAll])
  • NewClass( )
    Creates a subclass of the selected class in the class list.
  • DeactivateMenu( )
    Deactivates the add-in popup menu.
  • DisplayMenu( )
    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.
DisplayMenu(tnMenuMode)
  • DoAddIn( )
    Executes the specified add-in of the current or specific record of the table with the BROWSER alias.
DoAddIn([cAddInName])
  • FileMatch( )
    Compares the specified file against the specified file list to determine if the file is one associated with the add-in.
FileMatch(cFileName, cFileList)
  • ExportClass( )
    Generates and displays the definition source code of the selected class or the selected file in the class list.
ExportClass([lShow] [, tcExportToFileName])

Arguments

  • 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( )
    Finds class text within a class.
FindClass([cFind])
  • FormAddObject( )
    Adds an instance of the selected class in the class list to an external form.
FormAddObject(oObject [, nXCoord] [, nYCoord] [, lActivateForm] 
[, lDesignMode][, lNoShow] [, lNoErrors] [, lBuilder] [, oForm])

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( )
    Formats the text of generated methods in the display of the class definition code.
FormatMethods(cMethods)
  • FormatProperties( )
    Formats the text of generated properties in the display of the class definition source code.
FormatProperties(cProperties [, lAddObjectMode])
  • GetFile( )
    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.
GetFile([cFileExt])
  • GetTimeStamp( )
    Returns the character equivalent of a timestamp value. If no parameter is passed, returns the timestamp string of the currently selected file.
GetTimeStamp([ntimestamp])
  • IndentText( )
    Indents a block of text one tab.
IndentText(cCode)
  • IntToBin( )
    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".
IntToBin([nInteger])
  • ModifyClass( )
    Opens the selected class in the Class Designer.
  • MsgBox( )
    Displays the Class Browser message box. Similar to the Visual FoxPro MESSAGEBOX( ) function.
MsgBox(cMessage [, nType] [, cTitle])
  • NewFile( )
    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.
NewFile([cFileName] [, lOpenFile])
  • OpenFile( )
    Opens an existing class library (.vcx) or form (.scx) file. If a file name is not provided, the Open dialog box appears.
OpenFile([cFileName])
  • ProperBaseClass( )
    Returns the base class name in the proper case. For example, "combobox" would return as "ComboBox".
ProperBaseClass(cBaseClass)
  • RedefineClass( )
    Changes the parent class of the selected class in the class list.
RedefineClass([cAsClass] [, cClassLoc])
  • RefreshButtons( )
    Refreshes the Class Browser command buttons based on the file type.
  • RefreshClassIcon( )
    Reloads the class icon from the icon file.
  • RefreshClassList( )
    Refreshes the class list.
RefreshClassList([cDefaultClass] [, lIgnoreTable])
  • 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( )
    Refreshes the Member tabs to display information associated with the selected class in the class list and, if provided, the specified member.
RefreshMembers([tcDefaultMember])
  • 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( )
    Removes the selected class in the class list from its associated class library (.vcx) file.
RemoveClass([lConfirm])
  • RenameClass( )
    Changes the class name of the selected class in the class list.
RenameClass([cToClass])
  • 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( )
    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.
SeekClass([cClass][, cClassLibrary])
  • SeekMember( )
    Moves the member list pointer to a specific member.
SeekMember(tcMember)
  • SeekParentClass( )
    Displays the parent class of the selected class in the class list.
  • SetBusyState( )
    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.
SetBusyState(lBusyState)
  • SetFont( )
    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.
SetFont([cFontName][, nFontSize][, lFontBold][, lFontItalic])
  • ShowMenu( )
    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.
ShowMenu(aMenu[, cOnSelection])
  • TrimExt( )
    Truncates the file name extension.
TrimExt(cFileName [, lPlatformType])
  • TrimFile( )
    Truncates the file name and returns only the file name and path.
TrimFile(cFileName [, lPlatformType])
  • TrimPath( )
    Truncates the path name.
TrimPath(cFileName [, lTrimExt] [, lPlatformType])
  • UpdateReferences( )
    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.
UpdateReferences(tcOldClassLoc, tcOldClass, tcNewClassLoc, tcNewClass 
[, tlAllInstances])

Arguments

  • 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( )
    Validates the open class library (.vcx) or form (.scx) file.
VersionCheck([lShowErrorMsg])
  • ViewProperty( )
    Displays the value of a specific property of the selected class.
ViewProperty(cProperty)
  • WildcardMatch( )
    Compares strings for a wildcard match with the filters specified in the Type box.
WildcardMatch(cMatchExpList, cExpressionSearched)

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