Usina BRAdvPL Guide
Sign in
← All topics
CLASSPublished

FWMBrowse

FWMBrowse():New() --> oSelf

Class for building and controlling browse screens in the Protheus Framework. It centralizes columns, searches, filters, legends, branches, and the interface lifecycle.

MVCInterfaceBrowseFramework
01 · OVERVIEW

Overview

FWMBrowse provides a high-level layer for building browse screens in the Protheus Framework. The routine creates the object, defines its alias, description, filters, fields, legends, and other resources, and only then activates the interface with Activate().

02 · SYNTAX

Syntax

FWMBrowse():New() --> oSelf

Methods

NewCreates a new FWMBrowse object.FWMBrowse():New()-> oSelf
SetAliasFWMBrowse class method.FWMBrowse():SetAlias( <cAlias> ) -> NIL
Parameters
NameFormatRequiredDescriptionNotes
cAliasCharacterRequired

Table alias used by the browse.

SetDescriptionFWMBrowse class method.FWMBrowse():SetDescription( <cDescription> ) -> NIL
Parameters
NameFormatRequiredDescriptionNotes
cDescriptionCharacterRequired

Description displayed for the browse.

SetCanSaveAreaFWMBrowse class method.FWMBrowse():SetCanSaveArea( <lCanSaveArea> ) -> NIL
Parameters
NameFormatRequiredDescriptionNotes
lCanSaveAreaLogicalRequired

Controls whether the browse may save and restore the current work area.

ActivateActivates the browse and displays the configured interface.FWMBrowse():Activate(< oOwner >)-> NIL
Parameters
NameFormatRequiredDescriptionNotes
oOwnerObjectRequired

Owner object for the browse.

AfterExecuteUpdates browse boundaries after an action, restores the company file context, and releases the record lock.FWMBrowse():AfterExecute(< cFunction >, < nOption >, < nVerify >)-> NIL
Parameters
NameFormatRequiredDescriptionNotes
cFunctionCharacterRequired

Function associated with the selected action.

nOptionNumericRequired

Operation type requested from the browse.

nVerifyNumericRequired

Permission position to validate for the current user.

AddLegendAdds a visual legend based on a condition.FWMBrowse():AddLegend(< xCondition >, < cColor >, [< cTitle >] , [< cID >] , [< lFilter >] )-> NIL
Parameters
NameFormatRequiredDescriptionNotes
xConditionCaracter ou bloco de códigoRequired

AdvPL expression or code block that determines when the legend applies.

cColorCharacterRequired

Color used by the legend.

cTitleCharacterOptional

Optional legend or window title.

cIDCharacterOptional

Optional legend identifier.

lFilterLogicalOptional

Controls filter availability or immediate filter execution, according to the method.

BeforeExecuteChecks access permissions and whether the selected record can be maintained before executing an action.FWMBrowse():BeforeExecute(< cFunction >, < nOption >, < nVerify >, < cTitle >, < nRealOpc >, < nRotina >)-> NIL
Parameters
NameFormatRequiredDescriptionNotes
cFunctionCharacterRequired

Function associated with the selected action.

nOptionNumericRequired

Operation type requested from the browse.

nVerifyNumericRequired

Permission position to validate for the current user.

cTitleCharacterRequired

Optional legend or window title.

nRealOpcNumericRequired

Actual selected menu option.

nRotinaNumericRequired

Position of the routine item being accessed.

BrwGetFilReturns the description of a branch.FWMBrowse():BrwGetFil(< cFil >)-> cLasFil
Parameters
NameFormatRequiredDescriptionNotes
cFilCharacterRequired

Branch code.

ChangeTopBotUpdates the upper and lower browse boundaries, optionally applying the filter immediately.FWMBrowse():ChangeTopBot(< lDoFilter >)-> NIL
Parameters
NameFormatRequiredDescriptionNotes
lDoFilterLogicalRequired

Indicates whether the filter should be executed immediately.

CheckPermChecks whether the user has permission to execute the requested routine action.FWMBrowse():CheckPerm(< cFunction >, < nOption >, < nVerify >, < lShowHelp >)-> NIL
Parameters
NameFormatRequiredDescriptionNotes
cFunctionCharacterRequired

Function associated with the selected action.

nOptionNumericRequired

Operation type requested from the browse.

nVerifyNumericRequired

Permission position to validate for the current user.

lShowHelpLogicalRequired

Controls whether permission help is shown to the user.

ClassNameReturns the FWMBROWSE class name.FWMBrowse():ClassName()-> cClassName
ColumnsFieldsBuilds additional browse columns from the structure supplied through SetFields.FWMBrowse():ColumnsFields(< aColumns >)-> NIL
Parameters
NameFormatRequiredDescriptionNotes
aColumnsArray of recordsRequired

Array describing the browse columns. See the TOTVS reference for the complete positional structure.

DeActivateDeactivates the browse and ends its active interface cycle.FWMBrowse():DeActivate()-> NIL
ExecuteMDefExecutes the action selected from the functional menu.FWMBrowse():ExecuteMDef()-> NIL
GetCBoxReturns the displayed content for a field configured with X3_CBOX options.FWMBrowse():GetCBox(< nPosSx3 >, < cCampo >)-> cConteud
Parameters
NameFormatRequiredDescriptionNotes
nPosSx3NumericRequired

Field position in the data dictionary array.

cCampoCharacterRequired

Field containing the configured options.

GetSizeCBoxReturns the required column width for a field configured with X3_CBOX options.FWMBrowse():GetSizeCBox(< nPosSx3 >)-> nSize
Parameters
NameFormatRequiredDescriptionNotes
nPosSx3NumericRequired

Field position in the data dictionary array.

GetTimerReturns the TIMER object associated with the browse.FWMBrowse():GetTimer()-> oTimer
LoadColumnsLoads the standard browse columns or the fields configured for a temporary table.FWMBrowse():LoadColumns(< cProfFields >)-> aColumns
Parameters
NameFormatRequiredDescriptionNotes
cProfFieldsCharacterRequired

String containing fields from the legacy MBrowse structure.

LoadFilsReturns the branches available to the current user for the selected alias.FWMBrowse():LoadFils(< cAlias >)-> aFilial
Parameters
NameFormatRequiredDescriptionNotes
cAliasCharacterRequired

Table alias used by the browse.

SetAmbienteEnables the Environment/Walk-Thru related option in the browse.FWMBrowse():SetAmbiente(< lAmbiente >)-> NIL
Parameters
NameFormatRequiredDescriptionNotes
lAmbienteLogicalRequired

Enables the Environment option.

SetBotFunDefines the lower boundary used by the browse.FWMBrowse():SetBotFun(< cBotFun >)-> NIL
Parameters
NameFormatRequiredDescriptionNotes
cBotFunCharacterRequired

Lower browse boundary.

SetChgAllControls whether the user may change records belonging to other branches.FWMBrowse():SetChgAll(< lChgAll >)-> NIL
Parameters
NameFormatRequiredDescriptionNotes
lChgAllLogicalRequired

Allows changes to records from other branches.

SetExecuteDefDefines which browse option is executed when the user double-clicks an item.FWMBrowse():SetExecuteDef(< nExecuteDef >)-> NIL
Parameters
NameFormatRequiredDescriptionNotes
nExecuteDefNumericRequired

Browse option executed on double-click.

SetFieldsDefines fields or column structures to be added to the browse.FWMBrowse():SetFields(< aFields >)-> NIL
Parameters
NameFormatRequiredDescriptionNotes
aFieldsArray of recordsRequired

Array of fields or column definitions used by the browse.

SetFilialDefines the branches considered when displaying browse records.FWMBrowse():SetFilial(< aFils >)-> NIL
Parameters
NameFormatRequiredDescriptionNotes
aFilsArray of recordsRequired

Array containing the branches to display.

SetIniWindowDefines a code block executed when the browse window is initialized.FWMBrowse():SetIniWindow(< bIniWindow >)-> NIL
Parameters
NameFormatRequiredDescriptionNotes
bIniWindowCode blockRequired

Code block executed when the browse window starts.

SetSeeAllControls whether the user may view records belonging to other branches.FWMBrowse():SetSeeAll(< lSeeAll >)-> NIL
Parameters
NameFormatRequiredDescriptionNotes
lSeeAllLogicalRequired

Allows viewing records from other branches.

SetSeekEnables record search and optionally supplies a custom search structure.FWMBrowse():SetSeek(< lSeek >, < aSeek >)-> NIL
Parameters
NameFormatRequiredDescriptionNotes
lSeekLogicalRequired

Enables browse search.

aSeekArray of recordsRequired

Array describing custom search options.

SetTimerConfigures a code block and interval for periodic browse updates.FWMBrowse():SetTimer(< bTimerAction >, < nInterval >)-> NIL
Parameters
NameFormatRequiredDescriptionNotes
bTimerActionCode blockRequired

Code block executed on each timer update.

nIntervalNumericRequired

Update interval.

SetTopFunDefines the upper boundary used by the browse.FWMBrowse():SetTopFun(< cTopFun >)-> NIL
Parameters
NameFormatRequiredDescriptionNotes
cTopFunCharacterRequired

Upper browse boundary.

SetUseFilterEnables the standard browse filter.FWMBrowse():SetUseFilter(< lFilter >)-> NIL
Parameters
NameFormatRequiredDescriptionNotes
lFilterLogicalRequired

Controls filter availability or immediate filter execution, according to the method.

SetUseCaseFilterEnables the quick filter in the browse.FWMBrowse():SetUseCaseFilter(< lFilter >)-> NIL
Parameters
NameFormatRequiredDescriptionNotes
lFilterLogicalRequired

Controls filter availability or immediate filter execution, according to the method.

SetX3TelaDefines a rule used by FWFormStruct to control which dictionary fields are presented.FWMBrowse():SetX3Tela(< cTela >)-> NIL
Parameters
NameFormatRequiredDescriptionNotes
cTelaCharacterRequired

Rule used to select fields shown in the browse.

SetWalkThruEnables the Walk-Thru feature in the browse.FWMBrowse():SetWalkThru(< lWalkThru >)-> NIL
Parameters
NameFormatRequiredDescriptionNotes
lWalkThruLogicalRequired

Enables Walk-Thru.

SetOnlyFieldsRestricts the browse to the specified table fields.FWMBrowse():SetOnlyFields(< aFields >)-> NIL
Parameters
NameFormatRequiredDescriptionNotes
aFieldsArray of recordsRequired

Array of fields or column definitions used by the browse.

DestroyDestroys the object and releases its references to other objects.FWMBrowse():Destroy()-> NIL
SetMainProcConfigures the FWMBrowse main process behavior.FWMBrowse():SetMainProc()
OptionReportIndicates whether the browse report/print option is enabled.FWMBrowse():OptionReport()-> lOptionReport
03 · PRACTICAL EXAMPLE

Complete example

Local oBrowse := FWMBrowse():New()

oBrowse:SetAlias("SA1")
oBrowse:SetDescription("Customers")
oBrowse:SetUseFilter(.T.)
oBrowse:Activate()
Expected result

The browse is created for alias SA1, receives a description and filter support, and is then activated.

BEST PRACTICES
  • Configure the alias, description, filters, fields, and other options before Activate().
  • Keep business rules outside the presentation layer whenever possible.
  • Validate methods that depend on the LIB and Framework version in the target Protheus environment.
  • When maintaining legacy code, first identify whether the routine uses MBrowse, FWMBrowse, or MVC.
COMMON PITFALLS
  • Activating the browse before completing its configuration may produce incomplete behavior.
  • Some methods depend on Framework internals and may vary according to the LIB version.
  • Illustrative examples must be adapted to the actual alias, menu, and routine context.
REFERENCES
  1. TOTVS. FWMBrowse. TDN.
Status
Published
Page created on
Last reviewed on
Original language
Portuguese
Reviewed by
Usina.BR
0 approved comment(s)

Comments

There are no approved comments yet.

Sign in with Google or Microsoft to comment.

Powered by Usina Docs · Alpha