Usina BRAdvPL Guide
Sign in
← All topics
PRACTICAL GUIDEUnder review

UI handling with FWFormView

Binds model fields to view controls and containers.

UI handling with FWFormViewAdvPL
01 · OVERVIEW

Overview

FWFormView provides a model’s graphical UI. SetModel binds the model; AddField connects visual structure and submodel ID; SetOwnerView places the control in a box. IDs must exist and match. Atilio separates ModelDef/ViewDef; this adaptation covers visual composition without copying the custom dictionary, user rule or numbering. UI-only validation does not protect writes through other interfaces. The fragment assumes the model, structure and FORM_ED697 submodel already exist. (Sources: refs. 1–2.)

03 · PRACTICAL EXAMPLE

Commented example

// ViewDef fragment: oModel/oStruct exist; FORM_ED697 belongs to the model.
Local oView := FWFormView():New()
oView:SetModel(oModel)
oView:AddField("VIEW_ED697",oStruct,"FORM_ED697")
// Bind the same control ID to the created container.
oView:CreateHorizontalBox("BOX_ED697",100)
oView:SetOwnerView("VIEW_ED697","BOX_ED697")
Expected result

Composes a view without activating it or writing data. Return oView in the real ViewDef and verify its external owner. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

BEST PRACTICES
  • Keep business rules in the model. Check external owner when not invoked by FWBrowse, as documented.
  • Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Related content

REFERENCES
  1. TOTVS. FWFormView. Métodos e exemplo ViewDef. Accessed on 2026-10-28.
  2. Atilio. dan-atilio/AdvPL. Exemplos/Vídeo Aulas/018 - Modelo 1 em MVC/zModel1.prw. Arquivo completo analisado; adaptação editorial. Accessed on 2026-10-28.
Status
Under review
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