Change focus from one field to another on MVC screens (ADVPL)

0

Good afternoon, I set up a screen in ADVPL using the MVC pattern. This screen has FIELD and a GRID (parent and child).

No FIELD has only 1 barcode field, when it informs the bar code the system goes there in GRID and fills in the required information, the problem is that focus stays in GRID e does not return to the barcode field again.

I used SetFieldAction to trigger the function that fills the grid.

oView:SetFieldAction("ZAD_CODBAR", { |oView, cIDView, cField, xValue| **addLinha**(oView, cIDView, cField, xValue) } )


===============
static function **addLinha**(oView, cIDView, cField, xValue)
===============

local oMZAD := oModel:GetModel('mfZAD')
local oMZAE := oModel:GetModel('mgZAE')

// ultima linha do grid
oMZAE:GoLine(oMZAE:Length())

// preenche as informações
oMZAE:SetValue('ZAE_CODBAR',xValue)
oMZAE:SetValue('ZAE_QUANT',1)

// adiciona um alinha
oMZAE:AddLine()

// limpa o campo código de barras para ler novamente
oMZAD:SetValue('ZAD_CODBAR','')

// volta o focus para o campo código de barras
// neste ponto eu precisava voltar o focus para o campo ZAD_CODBAR
// tá tentei SetFocus(GetFocus(M->ZAD_CODBAR)) mas não funcionou

return
    
asked by anonymous 26.02.2018 / 20:14

0 answers