Classe Metro

Classe Metro

Postby Joaoalpande » Tue May 19, 2015 10:40 am

Boa Tarde,

Estou a ver vários exemplos da classe metro e não estou a conseguir 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
Joaoalpande
 
Posts: 33
Joined: Wed Sep 16, 2009 8:53 am

Re: Classe Metro

Postby Antonio Linares » Tue May 19, 2015 11:29 am

Joao,

Prueba asi:

Code: Select all  Expand view
  local oMetro

   DEFINE METRO oMetro ;
      TITLE "My FWH Metro app" ;
      BACKGROUND "..\bitmaps\hires\earth.bmp"
     
   while ! Eof()
      DEFINE METROBUTTON OF oMetro ;
         PROMPT FieldGet( 1 ) COLOR CLR_WHITE, RGB( 2, 174, 224 ) ;  // 1 primer campo
         IMAGE "..\bitmaps\metro\files.bmp" ;
         ACTION Records()  
      DbSkip()
   end
 
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41206
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Classe Metro

Postby Joaoalpande » Tue May 19, 2015 12:32 pm

Gracias Antonio Linares,

MUISTRA BIEN os metrobutton do dbf , cómo saber recno() do dbf el usuario hace clic ?

Saludos

João
Joaoalpande
 
Posts: 33
Joined: Wed Sep 16, 2009 8:53 am

Re: Classe Metro

Postby Antonio Linares » Tue May 19, 2015 3:28 pm

Joao,

Tienes que hacer esta modificación en metro.ch:
Code: Select all  Expand view
#xcommand DEFINE METROBUTTON [<oBtn>] ;
             [ PROMPT <cPrompt> ] ;
             [ COLOR <nClrText>, <nClrPane> ] ;
             [ IMAGE <cImgName> ] ;
             [ OF <oMetro> ] ;
             [ <large: LARGE> ] ;
             [ ACTION <uAction,...> ] ;
          => ;
             [ <oBtn> := ] <oMetro>:AddButton( <cPrompt>, <nClrText>, <nClrPane>,;
                <.large.>, <cImgName>, [{| Self |<uAction>}] )


Code: Select all  Expand view
 local oMetro, oBtn

   DEFINE METRO oMetro ;
      TITLE "My FWH Metro app" ;
      BACKGROUND "..\bitmaps\hires\earth.bmp"
     
   while ! Eof()
      DEFINE METROBUTTON oBtn OF oMetro ;
         PROMPT FieldGet( 1 ) COLOR CLR_WHITE, RGB( 2, 174, 224 ) ;  // 1 primer campo
         IMAGE "..\bitmaps\metro\files.bmp" ;
         ACTION ShowRecords( ::Cargo )  
      oBtn:Cargo = RecNo()
      DbSkip()
   end
 
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41206
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Classe Metro

Postby Joaoalpande » Wed May 20, 2015 10:27 am

ola Antonio Linares,

Alterei o metro.ch assim:
Code: Select all  Expand view
// FiveWin - Windows 8 Metro look

#ifndef _METRO_CH
#define _METRO_CH

//----------------------------------------------------------------------------//

#xcommand DEFINE METRO <oMtr> ;
             [ BACKGROUND <cFileName> ] ;
             [ BTNSIZE <nBtnWidth>, <nBtnHeight> ] ;
             [ TITLE <cTitle> ] ;
          => ;
          <oMtr> := TMetro():New( <cTitle>, <nBtnWidth>, <nBtnHeight>, <cFileName> )

xcommand DEFINE METROBUTTON [<oBtn>] ;
             [ PROMPT <cPrompt> ] ;
             [ COLOR <nClrText>, <nClrPane> ] ;
             [ IMAGE <cImgName> ] ;
             [ OF <oMetro> ] ;
             [ <large: LARGE> ] ;
             [ ACTION <uAction,...> ] ;
          => ;
             [ <oBtn> := ] <oMetro>:AddButton( <cPrompt>, <nClrText>, <nClrPane>,;
                <.large.>, <cImgName>, [{| Self |<uAction>}] )
#xcommand ACTIVATE METRO <oMtr> => <oMtr>:Activate()

//----------------------------------------------------------------------------//

#endif


alterei o metro.prg assim:
Code: Select all  Expand view
DEFINE METRO oMetro ;
      TITLE "My FWH Metro app" ;
      BACKGROUND "..\bitmaps\hires\earth.bmp"
    DBSELECTAREA( 1 )
    NET_USE ("F_REG.DBF", 3,.T.)
 while ! Eof()
      DEFINE METROBUTTON oBtn OF oMetro ;
         PROMPT FieldGet( 1 ) COLOR CLR_WHITE, RGB( 2, 174, 224 ) ;  // 1 primer campo
         IMAGE "..\bitmaps\metro\files.bmp" ;
         ACTION ShowRecords( ::Cargo )
        oBtn:Cargo = RecNo()
      DbSkip()
   end

   DEFINE METROBUTTON OF oMetro ;
      PROMPT "Exit" COLOR CLR_WHITE, RGB( 2, 174, 224 ) ;
      IMAGE "..\bitmaps\metro\exit.bmp" ;
      ACTION If( MsgYesNo( "Want to exit ?" ), oMetro:End(),)

   ACTIVATE METRO oMetro


dá error: Error description: Error description: Error BASE/1005 Class: 'NIL' has no property: CARGO

se retirar : oBtn:Cargo = RecNo() mostra bem os metrobutton mas quando clico num dá erro:

Error BASE/1003 Variable does not exist: SELF

Gracias
Joaoalpande
 
Posts: 33
Joined: Wed Sep 16, 2009 8:53 am

Re: Classe Metro

Postby Antonio Linares » Wed May 20, 2015 10:32 am

Por favor compílalo usando /b al llamar a Harbour.exe y comprueba que te aparece en el fichero.PPO
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41206
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Classe Metro

Postby Joaoalpande » Wed May 20, 2015 11:05 am

obrigado, o .ppo aparece assim, estou compilando com buildx.bat do samples:
Code: Select all  Expand view
oMetro := TMetro():New( "My FWH Metro app",,, "..\bitmaps\hires\earth.bmp" )
    DBSELECTAREA( 1 )
    NET_USE ("F_REG.DBF", 3,.T.)
    DBGOTOP()
 while ! Eof()
      oBtn := oMetro:AddButton( FieldGet( 1 ), 16777215, ( 2 + ( 174 * 256 ) + ( 224 * 65536 ) ), .F., "..\bitmaps\metro\files.bmp", {||ShowRecords(::Cargo )} )
         oBtn:Cargo :=RecNo()
      DbSkip()
   end
   oMetro:AddButton( "Exit", 16777215, ( 2 + ( 174 * 256 ) + ( 224 * 65536 ) ), .F., "..\bitmaps\metro\exit.bmp", {||If( MsgYesNo( "Want to exit ?" ), oMetro:End(),)} )
   oMetro:Activate()
Joaoalpande
 
Posts: 33
Joined: Wed Sep 16, 2009 8:53 am

Re: Classe Metro

Postby Antonio Linares » Wed May 20, 2015 1:18 pm

En el .ppo debería aparecer esto:

{| Self |ShowRecords(::Cargo )}

Has modificado el fichero metro.ch como te indiqué ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41206
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Classe Metro

Postby Joaoalpande » Wed May 20, 2015 1:31 pm

Desculpa Antonio Linares, o metro.ch estava errado , mas continua com o mesmo erro Error description: Error BASE/1005 Class: 'NIL' has no property: CARGO
.ppo esta:

Code: Select all  Expand view
  oMetro := TMetro():New( "My FWH Metro app",,, "..\bitmaps\hires\earth.bmp" )
    DBSELECTAREA( 1 )
    NET_USE ("F_REG.DBF", 3,.T.)
    DBGOTOP()
 while ! Eof()
      oBtn := oMetro:AddButton( FieldGet( 1 ), 16777215, ( 2 + ( 174 * 256 ) + ( 224 * 65536 ) ), .F., "..\bitmaps\metro\files.bmp", {| Self |ShowRecords(::Cargo )} )
         oBtn:Cargo :=RecNo()
      DbSkip()
   end
   oMetro:AddButton( "Exit", 16777215, ( 2 + ( 174 * 256 ) + ( 224 * 65536 ) ), .F., "..\bitmaps\metro\exit.bmp", {| Self |If( MsgYesNo( "Want to exit ?" ), oMetro:End(),)} )
   oMetro:Activate()
 
Joaoalpande
 
Posts: 33
Joined: Wed Sep 16, 2009 8:53 am

Re: Classe Metro

Postby Antonio Linares » Wed May 20, 2015 1:36 pm

Please try this change and let me know what you get:

Code: Select all  Expand view
while ! Eof()
      oBtn := oMetro:AddButton( FieldGet( 1 ), 16777215, ( 2 + ( 174 * 256 ) + ( 224 * 65536 ) ), .F., "..\bitmaps\metro\files.bmp", {| Self |ShowRecords(::Cargo )} )
         MsgInfo( ValType( oBtn ) )
         oBtn:Cargo :=RecNo()
      DbSkip()
   end
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41206
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Classe Metro

Postby Joaoalpande » Wed May 20, 2015 1:50 pm

information : U

Error description: Error BASE/1005 Class: 'NIL' has no property: CARG
Joaoalpande
 
Posts: 33
Joined: Wed Sep 16, 2009 8:53 am

Re: Classe Metro

Postby Joaoalpande » Thu May 21, 2015 3:18 pm

Ola antonio,

no forum fivewin brasil deram uma solução mas com dialog e button , não funciona com metro , veja:

http://fivewin.com.br/index.php?/topic/24015-classe-metro/

Saludos
Joaoalpande
 
Posts: 33
Joined: Wed Sep 16, 2009 8:53 am

Re: Classe Metro

Postby karinha » Thu May 21, 2015 3:35 pm

Master algo +- asi:

Code: Select all  Expand view

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. )
 
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7154
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Classe Metro

Postby Antonio Linares » Thu May 21, 2015 7:20 pm

Joao,

Que versión de FWH usas ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41206
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Classe Metro

Postby Joaoalpande » Thu May 21, 2015 9:49 pm

12.07
Joaoalpande
 
Posts: 33
Joined: Wed Sep 16, 2009 8:53 am

Next

Return to All products support

Who is online

Users browsing this forum: No registered users and 7 guests