joao Posted May 14, 2015 Report Share Posted May 14, 2015 Boa Tarde, Estou a ver vários exemplos da classe metro e não estou a consiguir fazer o que desejo, preciso o seguinte: na primeira tela quero que mostre 1 Metrobutton por cada registo da tabela REGIOES.DBF em que o caption é o campo nome desta mesma, quando o usuário clicar num deles preciso saber em que Recno() da REGIOES.DBF clicou , para depois fazer um filtro a tabela ARTIGOS.DBF em que o campo CodReg=RECNO() da tabela REGIOES clicado na primeira tela e mostrar todos os artigos filtrados em 1 metrobutton por cada registo, tem como fazer isso? Cumprimentos João Alpande Quote Link to comment Share on other sites More sharing options...
Theotokos Posted May 14, 2015 Report Share Posted May 14, 2015 ???? nuuuuuuuuuu ???? mostre o codigo para exemplificar o que você esta tentando fazer... ou se tiver mostre telas... Quote Link to comment Share on other sites More sharing options...
joao Posted May 14, 2015 Author Report Share Posted May 14, 2015 ???? nuuuuuuuuuu ???? mostre o codigo para exemplificar o que você esta tentando fazer... ou se tiver mostre telas... Boa Tarde, estou a tentar fazer o que disse no primeiro tópico , baixei um exemplo do forum internacional e alterei , só consigui mostrar a primeira tela com os button da tabela REGIOES.DBF , só não consigo saber em que recno() deste dbf o usuário clicou , fiz assi para mostrar a primeira tela: DBSELECTAREA(1) DBGOTOP() DO WHILE RECNO()<=20 IF !Empty((1)->N_FAM) Cnt++ nRec:=recno() DEFINE METROBUTTON oBt[cnt] OF oMetro1 ; COLOR CLR_HBLUE,CLR_WHITE ; CAPTION (1)->N_FAM ; ALIGN "MIDDLECENTER" ; GROUP 1; FONT oFont2 ; BODYTEXT "VINHO" ; TEXTALIGN "TOPCENTER" ; LARGE; ACTION NEW_DESK(oMetro1) ENDIF skip ENDDO cnt++ DEFINE METROBUTTON oBt[cnt] OF oMetro1 ; COLOR CLR_WHITE,RGB( 255, 0, 66 ) ; CAPTION "Exit" ; ALIGN "TOPRIGHT" ; GROUP 2 ; BITMAP c_path4 + "exit.bmp" ; BMPALIGN "BOTTOMLEFT" ; SIZE 48, 48 ; ACTION If( MsgYesNo( "Want to exit ?" ), oWnd:End(),) Quote Link to comment Share on other sites More sharing options...
kapiaba Posted May 14, 2015 Report Share Posted May 14, 2015 Eu acho que voce tem que guardar o Handle do botão, usando & macro, tenho exemplo, mas não está aqui. Se eu lembrar, semana que vem eu trago de casa. abs. Quote Link to comment Share on other sites More sharing options...
joao Posted May 15, 2015 Author Report Share Posted May 15, 2015 Eu acho que voce tem que guardar o Handle do botão, usando & macro, tenho exemplo, mas não está aqui. Se eu lembrar, semana que vem eu trago de casa. abs. Bom dia, aguardo , obrigado Quote Link to comment Share on other sites More sharing options...
kapiaba Posted May 15, 2015 Report Share Posted May 15, 2015 João, é algo +- assim que eu estou falando, só que voce vai identificar o objeto do botão. http://fivewin.com.br/index.php?/topic/18460-indentificar-objeto/?hl=acontrols#entry53293 Semana que vem eu vejo algo melhor. Eu acho... abs Quote Link to comment Share on other sites More sharing options...
kapiaba Posted May 15, 2015 Report Share Posted May 15, 2015 Agradecimentos especiais ao Edvaldo Quaresma, que cedeu o código graciosamente. João, veja se entede o giro dos botões: STATIC FUNCTION MARCARAULAS( xRgA, xDt, oDbfCadDig, oDbfTabela, oDbfTurmas, oDbfAulDig, oDbfExames, oDbfCaiDig, oDbfVendedor, oDbfMesAno) FIELD NOME, MAT, COD, DESC, TAB, TIPO, PARC, CHEPRE, ; RECIBO, RG, VENC, PAGO, UNID, DAT, DTP, VAL, OBS,NA,CARRO,INST,HORA,COD7 FIELD Aula1,Aula2,Aula3,Aula4,Aula5,Aula6,Aula7,Aula8,Aula9,Aula10,Aula11,Aula12 FIELD Aula13,Aula14,Aula15,Aula16,Aula17,Aula18,Aula19,Aula20,Au1,Au2,Au3,Au4,Au5 LOCAL oDlg, xDtV, oLbx, cProcura, oFont, iDcor, oIco, oSay, ; oFnt, oBrush, nID, oGroup, xSim:=0, xUAula, xPesq LOCAL oImagem, oHand, oIncluir, oAlterar, oSaida, oMenu, oExcluir LOCAL oPagtoAVista, oPagtoCCheque, oPagtoCheqPre, oPagtoBoleto, ; oPagtoCartao, oPagtoAPrazo, oPagtoOutros, oGravarDados, xValS LOCAL xRg, xDat, xNa, xTipo, xNome, xCarro,xInst,xBanca,xTDias,oQtd,xAulas LOCAL oChk, lCheckBox, oFont1, xH,xD, oH, oD, xQ, xLinha, xCol, xHora, xHr LOCAL oFont2, xCont, xMarca, xCont1, xValor, xQtd, xCod MEMVAR nRecNo, xMarcacao, xCodaula MEMVAR nCodigo MEMVAR XNOMEC, XMAT, XDESC, XPARC, XVAL, XRGAE, ; XNOMEESC, XCHEPRE, XRECIBO, XTERC, XBANCO, XAG, XCC, ; XNCHEQUE, XDONO, XNP, XVENC, XPAGO, XFORMA, XDTP MEMVAR aSays, aGet, xDeOnde // Para 9 Says e 8 Gets Invisiviseis... PUBLIC XENT xAulas:="Total de Aulas Marcadas: 000" If xCodAula = 0 xCod:=" " If MsgGet( "Escolha do tipo de aula",; "Digite o código da aula do aluno",@xCod) Else Return Nil Endif xCodAula:=Val(xCod) Endif Select( oDbfTabela:cAlias ) Set Order to 1 Seek xCodAula If Eof() ?"Código da aula inválido ou não cadastrado" Select( oDbfAulDig:cAlias ) Return Nil Endif xDesc:=AllTrim(DESC) xValor:=TAB Select( oDbfCadDig:cAlias ) Set Order to 1 Seek xRgA xCarro:=COD7 xInst :=INST If xCarro = 0 .And. MsgGet( "Carro do Aluno não Cadastrado",; "Digite o código do Carro que o aluno irá fazer aulas",@xCarro) TraveReg(0) Replace COD7 With xCarro Destrava() ElseIf xCarro <= 0 ?"Erro na escolha do carro do aluno" Return Nil Endif If oDbfMesAno !=Nil oDbfMesAno:Close() Endif IF NetUse( "MESANO", .T. ) // Falso ‚ Exclusivo .T. ‚ Shared DATABASE oDbfMesano // Como Escrevemos em Ingles oDbfMesano:Load() oDbfMesano:GoTop() oDbfMesano:SetBuffer( .T. ) ELSE MsgStop( "Banco de Dados MESANO Bloqueado", "Cuidado!" ) RETURN NIL ENDIF oH:=Array(24) xH:=Array(24) oD:=Array(31) xD:=Array(31) oChk:=Array(744) xQ :=Array(744) xTDias:=VAL(AU5) SndPlaySound(".\Init.Wav" ) CursorWait() DEFINE FONT oFnt NAME "Times New Roman" SIZE 0, -14 BOLD DEFINE FONT oFont NAME "Times New Roman" SIZE 0, 25 BOLD DEFINE FONT oFont1 NAME "Arial" SIZE 0, 11 BOLD DEFINE FONT oFont2 NAME "Times New Roman" SIZE 0, 19 BOLD *Ms Sans Serif DEFINE CURSOR oHand RESOURCE "Dedo" // Um Öcone no Lado Esquerdo da Tela DEFINE ICON OICO FILE ".\BRASIL__.BMP" DEFINE DIALOG oDlg ; FROM 0, 0 TO 50, 172 ; TITLE "Marcação de Aula de "+xDesc+" - Aluno: "+AllTrim(xMat)+" "+xNomeC ; COLOR nRGB( 127, 127, 127 ), nRGB( 143, 188, 143 ) ; STYLE nOr( DS_MODALFRAME ) ODLG:LHELPICON := .F. xCont:=1 xCol :=4 While xCont <= 24 SysRefresh() xHora:="AULA"+AllTrim(Str(xCont)) If xCont > 20 xHora:="AU"+AllTrim(Str(xCont-20)) Endif If Left(&(xHora),2) = " " Exit Endif xH[xCont]:=Left(&(xHora),2)+":"+Right(&(xHora),2) @ 0.2,xCol BUTTON oH[xCont] PROMPT xH[xCont] OF oDlg ; SIZE 27,15 FONT oFont xCol+=4.5 xCont+=1 Enddo xUAula:=xCont xCont:=1 xCol :=1.05 xDtV :=xDt While xCont <= xTdias //30 SysRefresh() @ xCol,0.5 BUTTON oD[xCont] PROMPT Left(Dtoc(xDt),5) OF oDlg ; SIZE 20,10 FONT oFont2 xCol+=0.58 xCont+=1 xDt+=1 Enddo xCont:=1 xLinha:=1.05 //1.4 xCol :=4.0 xHr :=1 xCont1:=1 xDt:=xDtV Select( oDbfAulDig:cAlias ) Set Order to 2 While xCont1 <= xTdias //720 SysRefresh() xPesq:=Dtos(xDt)+Left(xH[xHr],2)+Right(xH[xHr],2) Seek StrZero(xCarro,2)+xPesq If Eof() oChk[xCont]:="Hora Vaga" Else xRg:=RG Select(oDbfCadDig:cAlias) Seek xRg oChk[xCont]:=Left(NOME,9) Endif @ xLinha,xCol BUTTON xQ[xCont] PROMPT oChk[xCont] OF oDlg ; SIZE 27,10 FONT oFont1 ; ACTION ( xMarca:=Teste( oDlg, xH ),Iif(xMarca $xMarcacao,"",xMarcacao+=xMarca),; //oDlg:aControls[ 50 ]:lFocused ) ) xAulas:="Total de Aulas Marcadas: "+StrZero(Len(AllTrim(xMarcacao))/15,3),oQtd:Refresh() ) //oDlg:aControls[ 50 ]:lFocused ) ) xQ[xCont]:cargo:=StrZero(xCont,3)+xPesq //+Dtoc(xDt)+Left(xH[xCont1],2)+Right(xH[xCont1],2) //StrZero(xCont,3) xCont+=1 xHr+=1 xCol+=4.5 If xHr > 24 .Or. xHr >= xUAula xLinha+=0.58 xHr :=1 xCol :=4.0 xCont1+=1 xDt+=1 Endif Enddo @ 23.0, 0.5 SAY "Data de Inicio das Aulas:" ; SIZE 200,12 FONT oFnt OF oDlg ; COLOR CLR_BLACK, nRGB( 143, 188, 143 ) @ 26.2, 10 GET xDd VAR xDt FONT oFnt SIZE 50, 20 CENTER OF oDlg ; VALID(VoltaM( xRgA, xDt, oDlg, oDbfCadDig, oDbfTabela, oDbfTurmas, oDbfAulDig, oDbfExames, oDbfCaiDig, oDbfVendedor, oDbfMesAno) ) @ 18.82,24 BUTTON oPagtoAVista PROMPT "&Gravar os Dados" OF oDlg ; SIZE 70,20 FONT oFnt ; ACTION ( xSim:=1, oDlg:End() ) oPagtoAVista:cToolTip := ( "Gravar a Alteração de Dados" ) @ 18.82,40 BUTTON oSaida PROMPT "&Sair" OF oDlg ; SIZE 50,20 FONT oFnt ; ACTION( oDlg:End() ) oSaida:cToolTip := ( "Voltar Para o Menu Principal" ) @ 22.5,60 Say oQtd VAR xAulas OF oDlg ; SIZE 100,20 FONT oFnt SET FONT OF oPagtoAVista TO oFnt SET FONT OF oSaida TO oFnt ACTIVATE DIALOG oDlg If xSim = 1 xDeOnde:=5 xQtd :=0 xCont :=4 xCont1:=1 xMarca:=Subs(xMarcacao,xCont,12) While Len( AllTrim(xMarca) ) > 0 .And. xCont < Len(xMarcacao) Seek StrZero(xCarro,2)+xMarca If !Eof() ?"Já existe aula marcada no dia "+Left(xMarca,8)+" as "+Subs(xMarca,9,2)+":"+Right(xMarca,2)+CRLF+; "Marcação desta aula não efetuada." xCont+=15 xMarca:=Subs(xMarcacao,xCont,12) Loop Endif Adicione(0) Replace RG With xMat, DAT With Ctod(Subs(xMarca,7,2)+"/"+Subs(xMarca,5,2)+"/"+Subs(xMarca,1,4)) //Ctod(Left(xMarca,8)) Replace HORA With Right(xMarca,4), COD With xCodAula Replace CARRO With xCARRO, INST With xINST Destrava() xQtd+=1 xCont+=15 xMarca:=Subs(xMarcacao,xCont,12) Enddo Set Order to 1 Set SoftSeek On Seek xMat Set SoftSeek Off xCont:=0 While RG = xMat .And. !Eof() SysRefresh() xCont+=1 TraveReg(0) Replace NA With StrZero(xCont,3)+"a" Destrava() Skip Enddo xVal :=Round(xValor*xQtd,2) xParc:="01/01" If xQtd > 0 //1 é incluir debito GETDEBITOS( 1, oDbfCadDig, oDbfTabela, oDbfCaiDig, oDbfVendedor ) Endif If !MsgYesNo( "Impressão do Recibo de Aulas." + CRLF + ; "Você pode imprimir agora um Recibo" + CRLF + ; "da Marcação ou Alteração de Aulas." + CRLF + ; "Escolha uma das opções abaixo:" + CRLF + ; "[SIM] Para imprimir o recibo de aulas" + CRLF + ; "[NÃO] Para não imprimir o recibo de aulas", ; "Escolha uma opção....." ) = .F. SndPlaySound(".\Erro.wav" ) RECIBOAULAS( oDlg, oDbfCaiDig, oDbfCadDig, oDbfTabela, oDbfAulDig) ENDIF Endif Select(oDbfAulDig:cAlias) Set Order to 1 Select(oDbfCadDig:cAlias) Set Order to 2 xCodAula :=0 xMarcacao:="" EndDialog() oFnt:End() oFont:End() oDbfMesAno:Close() RETURN NIL Static Function Teste(oDlg, xH) Local nCounter,cVarRet For nCounter := 1 TO LEN( oDlg:aControls ) If oDlg:aControls[ nCounter ]:lFocused cVarRet:= oDlg:aControls[ nCounter ]:cargo Exit Endif Next *cvarret = 00115/03/150700 = 1 carro=contador data e hora da aula Return( cVarRet ) Static Function VoltaM( xRgA, xDt, oDlg, oDbfCadDig, oDbfTabela, oDbfTurmas, oDbfAulDig, oDbfExames, oDbfCaiDig, oDbfVendedor, oDbfMesAno) oDlg:End() MARCARAULAS( xRgA, xDt, oDbfCadDig, oDbfTabela, oDbfTurmas, oDbfAulDig, oDbfExames, oDbfCaiDig, oDbfVendedor, oDbfMesAno) Return( .T. ) // ---------------------- FIM DO PROGRAMA -----------------------------------// Quote Link to comment Share on other sites More sharing options...
kapiaba Posted May 15, 2015 Report Share Posted May 15, 2015 Imagem do giro dos botes: abs. Quote Link to comment Share on other sites More sharing options...
joao Posted May 15, 2015 Author Report Share Posted May 15, 2015 Imagem do giro dos botes: abs. Boa Tarde, Obrigado mas ainda não estou a conseguir através desse exemplo fazer o mesmo com a classe metro fazer isso, mas vou continuar a tentar. Cumprimentos João Alpande Quote Link to comment Share on other sites More sharing options...
joao Posted May 19, 2015 Author Report Share Posted May 19, 2015 Bom dia, nenhum colega tem um exemplo para fazer o que preciso mas com a classe metro? Cumprimentos João ALpande Quote Link to comment Share on other sites More sharing options...
kapiaba Posted May 21, 2015 Report Share Posted May 21, 2015 João, outra idéia: FUNCTION TESTEPRODU( oFld, _Folder, oPRODU, _LETRA, _INIPROD, _FIMPROD ) MEMVAR OCTL, _oProdu PUBLIC WPRODFOCO oCtl := oFld:aDialogs[_Folder]:oCtlFocus() WHILE _INIPROD <= _FIMPROD SYSREFRESH() _oProdu := oProdu+STRZERO(_INIPROD,2,0)+_LETRA IF (oCtl:hWnd = &_oProdu:hWnd) WPRODFOCO := _INIPROD EXIT ENDIF _INIPROD = _INIPROD + 1 ENDDO RETURN( .T. ) Quote Link to comment Share on other sites More sharing options...
joao Posted May 28, 2015 Author Report Share Posted May 28, 2015 Bom dia , com a ajuda do amigo Kapiaba e do Antonio Linares resolvi o problema . Antonio alterou metropnl.ch : <{uAction}> para [{| Self |<uAction>}] No meu prg fiz assim para pegar o recno() do arquivo dbf: while !eof() IF !EMPTY(FieldGet( 1 )) DEFINE METROBUTTON oBtn OF oMetro ; PROMPT oemtoansi(FieldGet( 1 )); COLOR CLR_WHITE,CLR_RED ; ALIGN "MIDDLECENTER" ; FONT oFontSmall2 ; GROUP 2 ; large; ACTION ShowRecords( ::Cargo,oWnd ,oMetro ) oBtn:Cargo := RecNo() ENDIF DbSkip() end Obrigado João Alpande kapiaba 1 Quote Link to comment Share on other sites More sharing options...
EDUTEK Posted February 21, 2018 Report Share Posted February 21, 2018 Só isso que tem que altera? Vou precisar fazer isso com Ordem de serviço, num terminal Touch, para abertuira e fechamento de OS. Quote Link to comment Share on other sites More sharing options...
joao Posted February 22, 2018 Author Report Share Posted February 22, 2018 Bom dia , o que deseja fazer? Abraço skype:joaoalpande e-mail: joaoalpande@gmail.com Quote Link to comment Share on other sites More sharing options...
EDUTEK Posted February 22, 2018 Report Share Posted February 22, 2018 Bom Dia Vai se para abrir e fechar servicos na OS, vou usar a classe metro para montar um quando com as OS aberta no momento, cada OS vai ser um botão Metro, que o mecânico vai tocar na tela touch e passar o cartão funcional num leitos RF-ID, por enquando não vai especificar qual o servico ele esta executando, somente vai startar o inicio e o final do serviço. já consegui fazer com a sua dica. Quote Link to comment Share on other sites More sharing options...
joao Posted February 22, 2018 Author Report Share Posted February 22, 2018 bom dia , ainda bem que deu certo, se precisar de alguma coisa é só adicionar ai no skype. abraço Quote Link to comment Share on other sites More sharing options...
EDUTEK Posted February 22, 2018 Report Share Posted February 22, 2018 beleza João, muito abrigado! outra coisa eu abrio as tabela no inicio do programa, quando clifor num botao que chamen euma atualizacao de dados, ele não traz o dbselectarea("oServico") ele diz que alias não existe, tem alguma particularidade a classe para nãop trazer a tabela aberta ? Quote Link to comment Share on other sites More sharing options...
joao Posted February 22, 2018 Author Report Share Posted February 22, 2018 Boa tarde , as funções estão dentro do mesmo prg? que eu saiba não ,nunca tive esse problema , só vendo o código e testando. Quote Link to comment Share on other sites More sharing options...
EDUTEK Posted February 23, 2018 Report Share Posted February 23, 2018 ******************************************************************************** * Empresa : TTGLog Logistica * * Desenvolvedor : Eduardo Mendes * * eMail..................: eduardo@ttglog.com.br * * Localização............: Limeira / SP / Brasil * ******************************************************************************** * Projeto.........: SysLog * * * * NOme do Projeto.: Sistema de Logistica (Window). * * * * Modulo Principal : syslog.Prg * * Modulo Atual : syslog_os_servico.Prg * * * * Banco de Dados Testado: DBFCDX / Oracle e SQLServer * * Ferramentas Testados: Fwh 1705, xHb 1.2.3, BCC 7.0, xDev 0.72 Black * * SqlRDD v2014 (MSSQL <= 2012 oracle <=10) * * Pellesc Editor de Recursos * ******************************************************************************** * Uso : Funcao de Metro BMP para controlar OS abertas com os Usuarios da * * Oficina * ******************************************************************************** * - Funçoes deste Modulo ==> * * * * - sysLog_os_servico( cParan) * * - Syslog_os_servico_Panel( oWnd ) * ******************************************************************************** #include "syslog.ch" *static oMetro, oTools *static nClrBack := CLR_GREEN *static oWnd, oFontLarge, oFontMed, oFontUL, oFontSmall,Omenu //----------------------------------------------------------------------------// function syslog_os_servicos( cParam ) local oWnd, oBar, oMetro, oBrush, oTimer local cTitle := "Ordem de Servicos - OS" mdata := date() **************************************************** abrindo Tabelas openfile("pessoal","pessoal","N","S","xcartao") openfile("motoris","motoris","N","S","xcodigo") openfile("frota","frota","N","S","xcodfro") openfile("oservico_s","oservico_s","N","S","xaberta") openfile("oservico","oservico","N","S","xchave") dbsetrelation("frota", {||oservico->frota} ,"oservico->frota") DEFINE TIMER oTimer INTERVAL 60000 ACTION {syslog_os_servicos_panel( oWnd ),msginfo("ativou em "+time())} OF oWnd DEFINE WINDOW oWnd TITLE cTitle STYLE nOr( WS_POPUP, WS_MAXIMIZE ); COLOR CLR_WHITE, CLR_GREEN oMetro := syslog_os_servicos_Panel( oWnd ) DEFINE BRUSH oBrush RESOURCE 'TTG_VEICULO' RESIZE oMetro:SetBrush( oBrush ) oBrush:End() oMetro:bRClicked := { |r,c,f,o| msginfo( 'HWND' + NUMTOHEX( oWnd:hWnd, 8 ) ) } ACTIVATE WINDOW oWnd MAXIMIZED ON INIT ( oMetro:Show(), oMetro:SetFocus(), oTimer:activate()) VALID(oMetro:End(), oTimer:Deactivate(), .t.) dbcloseall() Release All return nil //----------------------------------------------------------------------------// function syslog_os_servicos_panel( oWnd ) DEFINE METROPANEL oMetro OF oWnd TITLE "OS - Ordem de Serviço" ; COLOR CLR_WHITE, CLR_CYAN ; ON CLICK oWnd:End() oMetro:lDesignMode := .t. oMetro:nMetroTop := 150 oMetro:nMetroMargin := 050 oMetro:nBtnSize := 110 oMetro:nSliderTop := 100 @ 100, 50 SAY "Serviços Gerais" COLOR "W+/B" SIZE 150, 40 TRANSPARENT FONT oFontSmall PIXEL OF oMetro @ 100, 50 + 300 SAY "Manutenções Corretivas/Preventivas" COLOR "W+/B" SIZE 450, 40 TRANSPARENT FONT oFontSmall PIXEL OF oMetro ****************** primeiro grupo DEFINE METROBUTTON oBtn1 OF oMetro ; COLOR CLR_WHITE,RGB( 86, 177, 14 ) ; CAPTION "Sair" ; ALIGN "TOPCENTER" ; GROUP 1 ; BITMAP "imagem\metro\end.bmp" ; BMPALIGN "BOTTOMLEFT" ; SIZE 40, 40 ; BODYTEXT "Sair do; Painel" ; TEXTALIGN "MIDDLERIGHT" ; ACTION If( MsgYesNo( "Sair do Painel ?",".:: Atenção ::." ), oWnd:End(),) ******************************* segundo grupo mdata := date() mOrder := 1 syslog_os_importa_fw(mdata) dbselectarea("oServico") dbgotop() while !eof() mBodyText := oServico->frota+";"+iif(oServico->tp_manu="C","Corretiva","Preventiva") mBitMap := iif(frota->tipovei="C","imagem\cavalo_azul.bmp","imagem\carreta_azul.bmp") DEFINE METROBUTTON oBtn OF oMetro ; COLOR iif(oServico->execucao="S",CLR_HBLUE,CLR_HBLUE),CLR_WHITE ; CAPTION "OS "+alltrim(str(val(oServico->numero))) ; ALIGN "TOPCENTER" ; GROUP 2 ; BITMAP "&mBitmap" ; BMPALIGN "BOTTOMLEFT" ; SIZE 40, 20 ; BODYTEXT "&mBodyText" ; TEXTALIGN "MIDDLERIGHT" ; BACKGROUND "" ; ACTION syslog_os_servico_lanca(::Cargo) oBTn:Cargo := oServico->(recno()) oBtn:nClrCaption := CLR_HRED oServico->( dbskip()) loop enddo DEFINE METROBUTTON oBtn OF oMetro ; COLOR CLR_WHITE,RGB( 86, 177, 14 ) ; CAPTION "Sair" ; ALIGN "TOPCENTER" ; GROUP 3 ; BITMAP "imagem\casa.bmp" ; BMPALIGN "BOTTOMLEFT" ; SIZE 60, 40 ; BODYTEXT "Sair do; casa" ; TEXTALIGN "MIDDLERIGHT" ; ACTION tecla_virtual() oBtn:bOnMove := { |o,b| logfile( cFileSetExt( ExeName(), "log" ), { b:nTop, b:nLeft } ) } @ 10,10 BTNBMP oBtn RESOURCE "METRO_SAIR" ; SIZE 50,50 PIXEL OF oMetro CENTER NOBORDER TRANSPARENT ; ACTION oWnd:End() return oMetro //----------------------------------------------------------------------------// function SYSLOG_OS_SERVICO_LANCA(mRegistroOS) local oDlg, oBrush, oCbx, OsAY[1] , oGrup, oSay1, oSay2,; oBt1, oCbx1, oCbx2, oCbx3, oGet[1], oBtn1, obtn2 vTitulo := "Atualiza dados da Ordem de Serviço" xNome := "ok" mIDorder := 1 ********************************************************* Variaveis dos Dados mCartao := space(08) mTexto := "Favor passar o cartão Funcional pela LEITORA"+CRLF+; "ou DIGITE o seu codigo logo Abaixo." **************************************** DEFINE BITMAP oBmp RESOURCE "CARTOES" DEFINE ICON oIcon RESOURCE "FENIX" DEFINE BRUSH oBrush resource "CARTOES" RESIZE //"penguins.jpg" RESIZE *****--- INICIO DA DIALOG ---*************************************************** DEFINE DIALOG oDlg SIZE 600,310 PIXEL TRUEPIXEL ; TITLE ".:: Atualiza dados da Ordem de Serviço ::." ICON oIcon oDlg:oFont := oFont4 oDlg:lTransparent := .T. oDlg:lHelpIcon := .F. oDlg:nStyle := nOR( DS_MODALFRAME, DS_SYSMODAL, WS_POPUP, WS_CAPTION, WS_SYSMENU ) oDlg:SetColor( , nRGB( 238, 238, 238 ) ) @ 020, 260 SAY oSay[1] PROMPT mTexto OF oDlg font oFont6 RIGHT SIZE 325, 140 COLOR CLR_RED PIXEL @ 150, 260 GET oGet[1] VAR mCartao PICTURE "@!" SIZE 325, 30 PIXEL OF oDlg font oFont5 ; valid achaCartao("pessoal","xcartao",@mCartao,0,"",0,"") ; action {achacartao("pessoal","xcartao",@mCartao,0,{||buscacartao()},0," CADASTRO DE PESSOAL"),oDlg:refresh(),oBtn1:setfocus()} Update @ 195, 260 BTNBMP oBtn1 PROMPT "Executar" TOOLTIP "Grava alteração dos dados" RESOURCE "POSITIVO" 2007 OF oDlg ; SIZE 160,100 PIXEL ; ACTION { grava_servico_os(mRegistroOS, mCartao),oDlg:End() } oBtn1:bGotFocus := { || oBtn1:Click() } @ 195, 425 BTNBMP oBtn2 PROMPT "Desiste" TOOLTIP "Desiste a gravação alteração dos dados" RESOURCE "NEGATIVO" 2007 OF oDlg ; SIZE 160,100 PIXEL ; ACTION { oDlg:End() } ACTIVATE DIALOG oDlg CENTERED ; ON PAINT ( ABPaint( hDC, 01, 01, oBmp:hBitmap, 250 ) , ; RRECT():New(oDlg, 255, 010, 590, 140, .T.), ; RRECT():New(oDlg, 255, 145, 590, 185, .T.), ; RRECT():New(oDlg, 255, 190, 590, 300, .T.) ) oBmp:End() return nil ************************************************GRAVAÇÃO DOS DADOS function grava_servico_os(mRegistroOS,mcartao) dbselectarea("oServico") dbgoto(mRegistroOS) mFrota := oServico->frota mOS := oServico->numero mChaveOs := mcartao+mOs dbselectarea("oServico_s") dbsetorder("xaberta") dbseek(mchaveOS) if found() if oServico->numero <> mOs mRegistro := oservico_s->( recno()) grava_dados("A","oServico_s",{"datafim","horafim","status"},{date(), time(), "F"}, alias()) grava_dados("I","oServico_s",{"chave","numero","frota","cartao","dataini","horaini","status"},{ mchaveos, mOs,mFrota,mCartao,date(), time(), "A"}, alias()) else mRegistro := oservico_s->( recno()) grava_dados("A","oServico_s",{"datafim","horafim","status"},{date(), time(), "F"}, alias()) endif else grava_dados("I","oServico_s",{"chave","numero","frota","cartao","dataini","horaini","status"},{ mchaveos, mOs,mFrota,mCartao,date(), time(), "A"}, alias()) endif return .t. Function syslog_os_servicos_refresh() if mNumero_de_passagens = 6 mNumero_de_passagens = 0 mAltera_tudo ="S" mdata := date() dbselectarea("oServico") syslog_os_importa_fw(mData) dbselectarea("Oservico") mOrder := mIDorder endif mNumero_de_passagens++ dbselectarea("oServico") return .t. Segue o codigo Quote Link to comment Share on other sites More sharing options...
joao Posted February 26, 2018 Author Report Share Posted February 26, 2018 Bom dia , com a ajuda do amigo Kapiaba e do Antonio Linares resolvi o problema . Antonio alterou metropnl.ch : <{uAction}> para [{| Self |<uAction>}] No meu prg fiz assim para pegar o recno() do arquivo dbf: while !eof() IF !EMPTY(FieldGet( 1 )) DEFINE METROBUTTON oBtn OF oMetro ; PROMPT oemtoansi(FieldGet( 1 )); COLOR CLR_WHITE,CLR_RED ; ALIGN "MIDDLECENTER" ; FONT oFontSmall2 ; GROUP 2 ; large; ACTION ShowRecords( ::Cargo,oWnd ,oMetro ) oBtn:Cargo := RecNo() ENDIF DbSkip() end Obrigado João Alpande Boa tarde, desculpa a demora só agora vi a resposta, vc alterou metropnl.ch : <{uAction}> para [{| Self |<uAction>}] Se sim , que Linha dá erro, se não conseguir resolver e quiser me enviar para eu tentar aqui , mal possa posso ver para vc. Skype: joaoalpande Whatsapp: +55 67 9274-6393 Abraço João Alpande Quote Link to comment Share on other sites More sharing options...
EDUTEK Posted February 28, 2018 Report Share Posted February 28, 2018 meu metropnl.ch tá assim #ifndef DT_TOP #define DT_TOP 0 #define DT_LEFT 0 #define DT_CENTER 1 #define DT_RIGHT 2 #define DT_VCENTER 4 #define DT_BOTTOM 8 #define DT_WORDBREAK 16 #define DT_SINGLELINE 32 #define DT_CALCRECT 1024 #endif #xcommand DEFINE METROPANEL <oMetro> OF <oWnd> ; [ TITLE <cTitle> ] ; [ COLOR <nClrText>, <nClrPane> ] ; [ TILESIZE <nSize> ] ; [ ON CLICK <uAction> ] ; [ SCROLLBARCOLOR <nClrThumb>, <nClrScroll> ] ; => ; <oMetro> := TMetroPanel():New( <oWnd>, <cTitle>, <nClrText>, <nClrPane>, [{| Self |<uAction>}], <nSize>, ; <nClrThumb>, <nClrScroll> ) #xcommand DEFINE METROBUTTON [<oBtn>] OF <oMetro> ; [ <prmt:PROMPT,CAPTION> <cPrompt> ] ; [ COLOR <nClrText>, <nClrPane> ] ; [ ALIGN <nAlign> ] ; [ FONT <oFont> ] ; [ GROUP <nGroup> ] ; [ MENU <oSub> ] ; [ <bmp:BITMAP,IMAGE> <cImgName> [ BMPALIGN <nBmpAlign> ] [ SIZE <nBmpWidth>,<nBmpHeight> ] ] ; [ BACKGROUND <cImage> ] ; [ <large: LARGE> ] ; [ <txt:BODY,BODYTEXT,TEXT> <cText> [ TEXTALIGN <nTextAlign> ] [ TEXTFONT <oTextFont> ] ] ; [ ACTION <uAction,...> ] ; => ; [ <oBtn> := ] <oMetro>:AddButton( <.large.>, <nGroup>, <cPrompt>, [{| Self |<uAction>}], <nClrText>, <nClrPane>, ; <cImgName>, <oFont>, <nAlign>, <nBmpAlign>, <nBmpWidth>, <nBmpHeight>, ; <cText>, <nTextAlign>, <oTextFont>, <oSub>, <cImage>, <"uAction">, <"oSub"> ) #xcommand ADD [<oBtn>] TO METRO <oMetro> [<clauses,...>] => ; DEFINE METROBUTTON [<oBtn>] OF <oMetro> [<clauses>] a Quote Link to comment Share on other sites More sharing options...
joao Posted March 4, 2018 Author Report Share Posted March 4, 2018 boa tarde, desculpa a demora o meu esta assim, se não der certo e conseguir montar um exemplo e me enviar para eu testar aqui: joaoalpande@gmail.com /* * * MetroPnl.ch * * */ #include "fivewin.ch" #ifndef DT_TOP #define DT_TOP 0 #define DT_LEFT 0 #define DT_CENTER 1 #define DT_RIGHT 2 #define DT_VCENTER 4 #define DT_BOTTOM 8 #define DT_WORDBREAK 16 #define DT_SINGLELINE 32 #define DT_CALCRECT 1024 #endif #xcommand DEFINE METROPANEL <oMetro> OF <oWnd> ; [ TITLE <cTitle> ] ; [ COLOR <nClrText>, <nClrPane> ] ; [ TILESIZE <nSize> ] ; [ ON CLICK <uAction> ] ; [ SCROLLBARCOLOR <nClrThumb>, <nClrScroll> ] ; => ; <oMetro> := TMetroPanel():New( <oWnd>, <cTitle>, <nClrText>, <nClrPane>, <{uAction}>, <nSize>, ; <nClrThumb>, <nClrScroll> ) #xcommand DEFINE METROBUTTON [<oBtn>] OF <oMetro> ; [ <prmt:PROMPT,CAPTION> <cPrompt> ] ; [ COLOR <nClrText>, <nClrPane> ] ; [ ALIGN <nAlign> ] ; [ FONT <oFont> ] ; [ GROUP <nGroup> ] ; [ MENU <oSub> ] ; [ <bmp:BITMAP,IMAGE> <cImgName> [ BMPALIGN <nBmpAlign> ] [ SIZE <nBmpWidth>,<nBmpHeight> ] ] ; [ BACKGROUND <cImage> ] ; [ <large: LARGE> ] ; [ <txt:BODY,BODYTEXT,TEXT> <cText> [ TEXTALIGN <nTextAlign> ] [ TEXTFONT <oTextFont> ] ] ; [ ACTION <uAction,...> ] ; => ; [ <oBtn> := ] <oMetro>:AddButton( <.large.>, <nGroup>, <cPrompt>, [{| Self |<uAction>}], <nClrText>, <nClrPane>, ; <cImgName>, <oFont>, <nAlign>, <nBmpAlign>, <nBmpWidth>, <nBmpHeight>, ; <cText>, <nTextAlign>, <oTextFont>, <oSub>, <cImage>, <"uAction">, <"oSub"> ) #xcommand ADD [<oBtn>] TO METRO <oMetro> [<clauses,...>] => ; DEFINE METROBUTTON [<oBtn>] OF <oMetro> [<clauses>] Quote Link to comment Share on other sites More sharing options...
EDUTEK Posted March 5, 2018 Report Share Posted March 5, 2018 ok João vou verificar 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.