Application.SetupMenu allows you to customize the Stonefield Query menu, such as adding or removing functions.

The menu system is referenced with an object passed as the second parameter to the code. Top-level menu items, such as File, Edit, and Tools, are called "pads" and are referenced by members of the menu named with the English caption for the pad followed by "Pad." For example, the File pad is referenced by toMenu.FilePad. The names of the pads and their bars are shown in the following table.

Pad Pad Name Bar Bar Name
File FilePad New Report FileNew
    New Folder FileNewFolder
    Copy FileCopy
    Edit FileEdit
    Rename FileRename
    Delete FileDelete
    Open Database FileOpenDatabase
    Refresh Reports List FileRefreshReports
    Import Reports FileImportReports
    Export Selected Report FileExportReport
    Export Reports FileExportAllReports
    Preview FilePreview
    Print FilePrint
    Print Setup FilePrintSetup
    Exit FileExit
Edit EditPad Undo EditUndo
    Redo EditRedo
    Cut EditCut
    Copy EditCopy
    Paste EditPaste
    Clear EditClear
    Select All EditSelectAll
Tools ToolsPad Change Password ToolsChangePassword
    Maintain Users and Groups ToolsMaintainUsers
    Display Logged in Users ToolsLoggedInUsers
    License Manager ToolsLicenseMgr
    Schedule Report ToolsScheduleReport
    Scheduled Tasks ToolsScheduledTasks
    Manage Databases ToolsManageDatabases
    Template Editor ToolsTemplateEditor
    Formulas ToolsCalcEditor
    Import Email Addresses ToolsImportEmail
    Check New or Updated Sample Reports ToolsCheckSampleReports
    Analyze Reports ToolsReportsAnalyzer
    Usage Reporting ToolsUsageReporting
    Find Reports ToolsFindReports
    Other Data Sources ToolsManageOtherDataSources
    Options ToolsOptions
Help HelpPad Help Topics HelpHelpTopics
    Technical Support HelpTechSupport
    Support Center on the Web HelpTechSupportWeb
    Knowledgebase HelpKB
    Customer Portal HelpCustomerPortal
    Manual HelpManual
    News From CompanyName HelpNews
    Check for Updates HelpCheckUpdates
    About ApplicationName HelpAbout


To add a menu item (called a "bar") to a menu, call the pad's AddBar method, passing it the name (not caption) of the bar. You can then set properties of the bar object returned by AddBar. A bar object has the following properties:

  • cBarPosition: specifies where the bar is placed. Blank means the end of the menu, "before BarName" means before the specified bar, and "after BarName" means after the specified bar.

  • cCaption: the caption for the menu item. Use "&" in front of a letter to indicate that letter as a hot key for the bar. Required.

  • cOnClickCommand: the expression to execute when the item is chosen in the menu. This will normally call a script you create. Required.

  • cPictureFile: the name of an image file to display in the menu (optional; if it isn't specified, no image is displayed).

  • cSkipFor: an expression that indicates when the item should be disabled; leave it blank if it's always enabled.

  • lVisible: set this to false to hide the bar.

After adding bars to a pad, call the pad's Show method to redisplay the menu.

Parameters
A reference to the Stonefield Query Application object and a reference to the menu system object.

Return Value
Any value (Stonefield Query ignores the return value).

Example
Here's an example taken from Stonefield Query for Sage Pro ERP that adds a "Import Report Writer reports" bar named FileImportFF to the File pad. cOnClickCommand is set to ImportFF, which calls a custom script with that name.

Visual FoxPro

lparameters toApplication as SQApplication, toMenu
local loBar
loBar = toMenu.FilePad.AddBar('FileImportFF')
with loBar
    .cBarPosition    = 'before FileExportReport'
    .cPictureFile    = 'importxpsmall.bmp'
    .cCaption        = 'Import ACCPAC Report &Writer Reports...'
    .cOnClickCommand = 'ImportFF()'
endwith
toMenu.FilePad.Show()

Example

Here's an example that hides the Schedule Report and Formulas functions in the Tools pad.

Visual FoxPro

lparameters toApplication as SQApplication, toMenu
toMenu.ToolsPad.ToolsScheduleReport.lVisible = .F.
toMenu.ToolsPad.ToolsCalcEditor.lVisible = .F.

See also

Scripts

© Stonefield Software Inc., 2023 • Updated: 05/09/22
Comment or report problem with topic