Usina BRAdvPL Guide
Sign in
← All topics
INCLUDEUnder review

FWMVCDef.ch

#Include "FWMVCDef.ch"

Provides definitions used by Framework MVC routines, including operation constants that require current-LIB confirmation.

IncludesMVCFrameworkConstantsUnder review
01 · OVERVIEW

Overview

FWMVCDef.ch is commonly used by MVC sources for Framework constants and definitions. ModelDef(), ViewDef() and MenuDef() are conventional routine functions, not commands transformed by the include itself. TopConn.ch serves SQL access and is not the MVC persistence mechanism. Confirm operation constants and values in the include for the target release.

02 · SYNTAX

Syntax

#Include "FWMVCDef.ch"

Parameters

FWMVCDef.ch
.ch fileOptional

Used by MVC resources; confirm which source symbols actually depend on it.

Return value

No runtime return value; it provides compile-time definitions.

03 · PRACTICAL EXAMPLE

Minimal MVC function structure

#Include "TOTVS.ch"
#Include "FWMVCDef.ch"

Static Function ModelDef()
    Local oModel := MPFormModel():New("EXAMPLE")
Return oModel

Static Function ViewDef()
    Local oView := FWFormView():New()
    oView:SetModel(ModelDef())
Return oView
Expected result

The include provides definitions; the developer still implements ModelDef() and ViewDef().

BEST PRACTICES
  • Separate architectural conventions from actual macros and constants.
  • Confirm operation constants in current documentation and files.
  • Keep SQL, model, view and menu responsibilities separate.
COMMON PITFALLS
  • Calling it mandatory for every MVC screen is too broad.
  • TopConn.ch does not automatically manage MVC validation or persistence.
  • Do not replace named constants with numeric literals.

Related content

REFERENCES
  1. GOOGLE. Dictionary of Commands, Common Constants and Tested Practical Examples. Generated Aug. 8, 2026; reviewed and adapted.
  2. TOTVS. MVC material previously incorporated into the AdvPL Guide.
Status
Under review
Page created on
Last reviewed on
Original language
Portuguese
Reviewed by
Usina.BR