UI handling with FWFormView
Binds model fields to view controls and containers.
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.)
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")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.
- 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.

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