Olá. Comecei com ADVPL há poucos meses e estou criando um cadastro MVC. A tela aparece normalmente e carrega os dados já existentes na tabela, mas quando eu interajo com qualquer opção do Menu aparece o erro:
"THREAD ERROR (20/07/2022 12:05:47 argumento #0 , parâmetro oObj erro, previsto O->U on FWFORMVIEW:SETMODEL(FWFORMVIEW.PRW) 04/02/2022 16:14:28 line : 720"
Alguma ideia de como corrigir?
Segue o meu fonte:
#Include 'Protheus.ch'
#include 'parmtype.ch'
#Include 'FWMVCDef.ch'
Static cTitulo := "Atividades"
user function CADZME()
Local aArea := GetArea()
Local oBrowse := Nil
oBrowse := FWMBrowse():New()
oBrowse:SetAlias("ZME")
oBrowse:SetDescription(cTitulo)
oBrowse:Activate()
RestArea(aArea)
Return Nil
Static Function MenuDef()
Local aRotina := {}
ADD OPTION aRotina TITLE 'Visualizar' ACTION 'VIEWDEF.CADZME' OPERATION 2 ACCESS 0
ADD OPTION aRotina TITLE 'Incluir' ACTION 'VIEWDEF.CADZME' OPERATION 3 ACCESS 0
ADD OPTION aRotina TITLE 'Alterar' ACTION 'VIEWDEF.CADZME' OPERATION 4 ACCESS 0
ADD OPTION aRotina TITLE 'Excluir' ACTION 'VIEWDEF.CADZME' OPERATION 5 ACCESS 0
Return aRotina
Static Function ModelDef()
Local oModel as object
Local oStZME as object
oModel := MPFormModel():New("MODEL_ZME",/*bPre*/, /*bPos*/,/*bCommit*/,/*bCancel*/)
oStZME := FWFormStruct(1, "ZME")
oModel:AddFields("FORMZME",/*cOwner*/,oStZME)
oModel:SetPrimaryKey({'ZME_FILIAL'})
Return oModel
Static Function ViewDef()
Local oModel := FWLoadModel("MODEL_ZME")
Local oStZME as object
Local oView as object
oStZME := FWFormStruct(2, "ZME")
oView := FWFormView():New()
oView:SetModel(oModel)
oView:AddField("VIEW_ZME", oStZME, "FORMZME")
oView:CreateHorizontalBox("TELA",100)
oView:SetOwnerView('VIEW_ZME','TELA')
oView:SetCloseOnOk({||.T.})
Return oView