In some few moments the user used an action triggered by a button in a dialog before the function defined in the "On Init" end
I don't know how to simulate but I think that a MsgRun() in the On Init Clause should help because of the change of focus to a modal dialog that will prevent the user to activate the button.
- Code: Select all Expand view
//-- The dialog
oDlgVenda = TDialog():New(,,,,, cResource,, .F.,,,,, oWnd, .F.,,,,,, .F. )
//-- The button pressed
oBtnPre := TButtonBmp():ReDefine( 206, {||TransVenda("P")}, oDlgVenda,,, .F., {|| HabPreOrc("P")},, "Pre-venda->Venda"+Chr(13)+Chr(10)+"F&7", .F., "Prevenda"+cTam, Upper("TEXTRIGHT"), )
//-- Dialog Activate
//-- PPO
//oDlgVenda:Activate( oDlgVenda:bLClicked, oDlgVenda:bMoved, oDlgVenda:bPainted, .T., {|Self|( cSairVda .AND. !lTravaSaida )},, {|Self|NovaVenda(.T.)}, oDlgVenda:bRClicked,, )
//-- PRG
Activate Dialog oDlgVenda CENTERED On Init NovaVenda(.t.) valid ( cSairVda .And. !lTravaSaida )
//-- Workaround
Activate Dialog oDlgVenda CENTERED On Init MsgRun("Inicializando a tela de vendas","Aguarde",{||NovaVenda(.t.)}) valid ( cSairVda .And. !lTravaSaida )