oziel Posted September 13, 2013 Report Share Posted September 13, 2013 Caros colegas. Tenho uma função abaixo que após a pesquisa, pega os dados e retorna. O que eu queria é saber se há uma forma de que após a seleção no banco de dados, eu apertar a tecla ENTER e ele selecionar os dados. Na forma atual quando damos um click (DBCLK) no cliente selecionado ou acionamos o botão volta, ele faz essa ação, através da Function PesqCli3(). Abraços //------------------------------------------------------------------------------------------------------------------------------------- FUNCTION PesqCli2(cPNomec,cCodc,cNomeC,cEres,cRBair,cCity,cCPF,cRFone,nLCred,cTipoDoc,oDlg) LOCAL oDlg2, oLbx2 // Objetos Caixa de Dialogo LOCAL oFnt, oG120 // Abrir Base Dados --------------------------------------------------- Select CADCLI Set Index to CADCLI Set Order to 1 DbGoTop() CADCLI->(DBSEEK(ALLTRIM(cPNomec))) If ! Found() MsgStop(OemToAnsi("Cliente nao Cadastrado: " , " Mensagem ")) Return .F. Endif// Caixa de Dialogo --------------------------------------------------- DEFINE FONT oFnt NAME "Arial" SIZE 0, -10 oNome = Space(20) DEFINE DIALOG oDlg2 RESOURCE "BROWSEDUPCLI" TITLE "SICEW - CORE - Cadastro de Clientes." REDEFINE LISTBOX oLbx2 FIELDS CADCLI->CODC , ; SUBST(CADCLI->NOME,1,30) , ; CADCLI->RFONE , ; CADCLI->ERES , ; CADCLI->RBAIR , ; CADCLI->CITY ; HEADERS "Codigo","Cliente","Telefone","End. ","Bairro","Cidade"; FIELDSIZES 48, 220, 60, 70, 70, 60 ; COLOR CLR_BLACK, CLR_MENTA2 ; FONT oFnt ; ID 101 ; OF oDlg2 ; ON DBLCLICK(PegaCli3(@cPNomec,@cCodc,@cNomeC,@cEres,@cRBair,@cCity,@cCPF,@cRfone,@nLCred,@cTipoDoc),oLbx2:Refresh(), oDlg2:End())REDEFINE BTNBMP RESOURCE "BTNVOLTA" ID 109 OF oDlg2 ; ACTION( PegaCli3(@cPNomec,@cCodc,@cNomeC,@cEres,@cRBair,@cCity,@cCPF,@cRfone,@nLCred,@cTipoDoc),,oLbx2:Refresh(),oDlg2:End() ); TOOLTIP OemToAnsi( "Voltar ao Menu Principal" ) ; NOBORDER ACTIVATE DIALOG oDlg2 CENTERED RELEASE oFntRETURN .T.//------------------------------------------------------------------------ Function PegaCli3(cPNomec,cCodc,cNomeC,cEres,cRBair,cCity,cCPF,cRfone,nLCred,cTipoDoc,oDlg) SysRefresh() cCodc := CadCli->Codc cNomeC := CadCli->Nome cEres := CadCli->ERes cRBair := CadCli->RBair cCity := CadCli->City cCPF := CadCli->CPF cRfone := CadCli->RFone nSaldt := CadCli->Saldt cTipoDoc := Cadcli->TipoDoc nLCred := Cadcli->LCred - Cadcli->Saldt CadCli->(DbsetOrder(1)) Return .F.//------------------------------------------------------------------------- Quote Link to comment Share on other sites More sharing options...
joaosolution Posted September 13, 2013 Report Share Posted September 13, 2013 Oziel oLbx2:bKeyDown:={|nKey|iif(nKey == K_ENTER ,; PegaCli3(@cPNomec,@cCodc,@cNomeC,@cEres,@cRBair,@cCity,@cCPF,@cRfone,@nLCred,@cTipoDoc),oLbx2:Refresh(), oDlg2:End(),; } Att João Bosco Quote Link to comment Share on other sites More sharing options...
oziel Posted September 17, 2013 Author Report Share Posted September 17, 2013 Ei João Deu um probleminha, mais consegui resolver. Obrigado e Forte abraço. oLbx2:bKeyDown := {|nKey| IIF (nKey == K_ENTER , (PegaCli3(@cPNomec,@cCodc,@cNomeC,@cEres,@cRBair,@cCity,@cCPF,@cRfone,@nLCred,@cTipoDoc),(oLbx2:Refresh(), oDlg2:End())),)}// OK Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.