FWMBrowse
FWMBrowse():New() --> oSelfClass for building and controlling browse screens in the Protheus Framework. It centralizes columns, searches, filters, legends, branches, and the interface lifecycle.
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().
Syntax
FWMBrowse():New() --> oSelfMethods
NewCreates a new FWMBrowse object.FWMBrowse():New()-> oSelf
SetAliasFWMBrowse class method.FWMBrowse():SetAlias( <cAlias> ) -> NIL
cAliasCharacterRequiredTable alias used by the browse.
SetDescriptionFWMBrowse class method.FWMBrowse():SetDescription( <cDescription> ) -> NIL
cDescriptionCharacterRequiredDescription displayed for the browse.
SetCanSaveAreaFWMBrowse class method.FWMBrowse():SetCanSaveArea( <lCanSaveArea> ) -> NIL
lCanSaveAreaLogicalRequiredControls whether the browse may save and restore the current work area.
ActivateActivates the browse and displays the configured interface.FWMBrowse():Activate(< oOwner >)-> NIL
oOwnerObjectRequiredOwner 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
cFunctionCharacterRequiredFunction associated with the selected action.
nOptionNumericRequiredOperation type requested from the browse.
nVerifyNumericRequiredPermission position to validate for the current user.
AddLegendAdds a visual legend based on a condition.FWMBrowse():AddLegend(< xCondition >, < cColor >, [< cTitle >] , [< cID >] , [< lFilter >] )-> NIL
xConditionCaracter ou bloco de códigoRequiredAdvPL expression or code block that determines when the legend applies.
cColorCharacterRequiredColor used by the legend.
cTitleCharacterOptionalOptional legend or window title.
cIDCharacterOptionalOptional legend identifier.
lFilterLogicalOptionalControls 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
cFunctionCharacterRequiredFunction associated with the selected action.
nOptionNumericRequiredOperation type requested from the browse.
nVerifyNumericRequiredPermission position to validate for the current user.
cTitleCharacterRequiredOptional legend or window title.
nRealOpcNumericRequiredActual selected menu option.
nRotinaNumericRequiredPosition of the routine item being accessed.
BrwGetFilReturns the description of a branch.FWMBrowse():BrwGetFil(< cFil >)-> cLasFil
cFilCharacterRequiredBranch code.
ChangeTopBotUpdates the upper and lower browse boundaries, optionally applying the filter immediately.FWMBrowse():ChangeTopBot(< lDoFilter >)-> NIL
lDoFilterLogicalRequiredIndicates 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
cFunctionCharacterRequiredFunction associated with the selected action.
nOptionNumericRequiredOperation type requested from the browse.
nVerifyNumericRequiredPermission position to validate for the current user.
lShowHelpLogicalRequiredControls 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
aColumnsArray of recordsRequiredArray 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
nPosSx3NumericRequiredField position in the data dictionary array.
cCampoCharacterRequiredField containing the configured options.
GetSizeCBoxReturns the required column width for a field configured with X3_CBOX options.FWMBrowse():GetSizeCBox(< nPosSx3 >)-> nSize
nPosSx3NumericRequiredField 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
cProfFieldsCharacterRequiredString containing fields from the legacy MBrowse structure.
LoadFilsReturns the branches available to the current user for the selected alias.FWMBrowse():LoadFils(< cAlias >)-> aFilial
cAliasCharacterRequiredTable alias used by the browse.
SetAmbienteEnables the Environment/Walk-Thru related option in the browse.FWMBrowse():SetAmbiente(< lAmbiente >)-> NIL
lAmbienteLogicalRequiredEnables the Environment option.
SetBotFunDefines the lower boundary used by the browse.FWMBrowse():SetBotFun(< cBotFun >)-> NIL
cBotFunCharacterRequiredLower browse boundary.
SetChgAllControls whether the user may change records belonging to other branches.FWMBrowse():SetChgAll(< lChgAll >)-> NIL
lChgAllLogicalRequiredAllows changes to records from other branches.
SetExecuteDefDefines which browse option is executed when the user double-clicks an item.FWMBrowse():SetExecuteDef(< nExecuteDef >)-> NIL
nExecuteDefNumericRequiredBrowse option executed on double-click.
SetFieldsDefines fields or column structures to be added to the browse.FWMBrowse():SetFields(< aFields >)-> NIL
aFieldsArray of recordsRequiredArray of fields or column definitions used by the browse.
SetFilialDefines the branches considered when displaying browse records.FWMBrowse():SetFilial(< aFils >)-> NIL
aFilsArray of recordsRequiredArray containing the branches to display.
SetIniWindowDefines a code block executed when the browse window is initialized.FWMBrowse():SetIniWindow(< bIniWindow >)-> NIL
bIniWindowCode blockRequiredCode block executed when the browse window starts.
SetSeeAllControls whether the user may view records belonging to other branches.FWMBrowse():SetSeeAll(< lSeeAll >)-> NIL
lSeeAllLogicalRequiredAllows viewing records from other branches.
SetSeekEnables record search and optionally supplies a custom search structure.FWMBrowse():SetSeek(< lSeek >, < aSeek >)-> NIL
lSeekLogicalRequiredEnables browse search.
aSeekArray of recordsRequiredArray describing custom search options.
SetTimerConfigures a code block and interval for periodic browse updates.FWMBrowse():SetTimer(< bTimerAction >, < nInterval >)-> NIL
bTimerActionCode blockRequiredCode block executed on each timer update.
nIntervalNumericRequiredUpdate interval.
SetTopFunDefines the upper boundary used by the browse.FWMBrowse():SetTopFun(< cTopFun >)-> NIL
cTopFunCharacterRequiredUpper browse boundary.
SetUseFilterEnables the standard browse filter.FWMBrowse():SetUseFilter(< lFilter >)-> NIL
lFilterLogicalRequiredControls filter availability or immediate filter execution, according to the method.
SetUseCaseFilterEnables the quick filter in the browse.FWMBrowse():SetUseCaseFilter(< lFilter >)-> NIL
lFilterLogicalRequiredControls 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
cTelaCharacterRequiredRule used to select fields shown in the browse.
SetWalkThruEnables the Walk-Thru feature in the browse.FWMBrowse():SetWalkThru(< lWalkThru >)-> NIL
lWalkThruLogicalRequiredEnables Walk-Thru.
SetOnlyFieldsRestricts the browse to the specified table fields.FWMBrowse():SetOnlyFields(< aFields >)-> NIL
aFieldsArray of recordsRequiredArray 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
Complete example
Local oBrowse := FWMBrowse():New()
oBrowse:SetAlias("SA1")
oBrowse:SetDescription("Customers")
oBrowse:SetUseFilter(.T.)
oBrowse:Activate()The browse is created for alias SA1, receives a description and filter support, and is then activated.
- 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.
- 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.

Comments
There are no approved comments yet.
Sign in with Google or Microsoft to comment.