Nueva Clase TMeterEx

User avatar
Daniel Garcia-Gil
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita
Contact:

Nueva Clase TMeterEx

Post by Daniel Garcia-Gil »

Nueva clase para FiveWin, nuevo estilo para la clase TMeter

Image

http://www.sitasoft.net/fivewin/samples/meterex.rar

Code: Select all

#include "FiveWin.ch"

function Main()

   LOCAL oWnd, nActual, nActual2, nActual3, nActual4
   LOCAL oMeter, oMeter2, oMeter3, oMeter4

   DEFINE WINDOW oWnd

   nActual := nActual2 := nActual3 := nActual4 := 0
   
   //   meter 1
   @ 10, 50 METEREX oMeter VAR nActual SIZE 310, 40 BITMAP ".\meterex.bmp" TOTAL 50 PIXEL 
   @ 60,  50 BUTTON "+" ACTION ( nActual := oMeter:Set( nActual += 1 ) ) SIZE 25, 20 PIXEL
   @ 60,  80 BUTTON "-" ACTION ( nActual := oMeter:Set( nActual -= 1 ) ) SIZE 25, 20 PIXEL
   @ 60, 110 BUTTON "Rst" ACTION ( nActual := oMeter:Set( 0 ), oMeter:Refresh() ) SIZE 25, 20 PIXEL
   @ 60, 140 BUTTON "Auto" ACTION ( Automatic( oMeter, @nActual ) ) SIZE 70, 20 PIXEL
   @ 60, 215 CHECKBOX oMeter:lInverted PROMPT "inverted" PIXEL SIZE 70, 12 
   @ 60, 290 CHECKBOX oMeter:lVertical PROMPT "Vertical" PIXEL SIZE 70, 12 
   
   // meter 2
   @ 100, 50 METEREX oMeter2 VAR nActual2 SIZE 310, 20 TOTAL 50 PIXEL;
             GRADIENT TRACK { { 1/2, nRGB( 198, 203, 213 ), nRGB( 219, 224, 233 ) },;
                                { 1/2, nRGB( 224, 238,237 ), nRGB( 224, 238,237 ) } } ;
             LINECOLORS nRGB( 110, 151,204 ), CLR_WHITE;
             ROUND INVERTED;
             ON PAINT( If( nActual2 == oMeter2:nTotal, Msginfo( "Finished" ), ) ) 
   
   @ 130,  50 BUTTON "+" ACTION ( nActual2 := oMeter2:Set( nActual2 += 1 ) ) SIZE 25, 20 PIXEL
   @ 130,  80 BUTTON "-" ACTION ( nActual2 := oMeter2:Set( nActual2 -= 1 ) ) SIZE 25, 20 PIXEL
   @ 130, 110 BUTTON "Rst" ACTION ( nActual2 := 0, oMeter2:Set( 0 ), oMeter2:Refresh() ) SIZE 25, 20 PIXEL
   @ 130, 140 BUTTON "Auto" ACTION ( Automatic( oMeter2, @nActual2 ) ) SIZE 70, 20 PIXEL
   @ 130, 215 CHECKBOX oMeter2:lInverted PROMPT "inverted" PIXEL SIZE 70, 12 
   @ 130, 290 CHECKBOX oMeter2:lVertical PROMPT "Vertical" PIXEL SIZE 70, 12 


   // meter 3
   @ 180, 50 METEREX oMeter3 VAR nActual3 SIZE 310, 20 TOTAL 50 PIXEL;
             GRADIENT CHUNK { { 1/2, nRGB( 255, 251, 229 ), nRGB( 250, 223, 143 ) } , ;
                              { 1/2, nRGB( 244, 194,  51 ), nRGB( 252, 235,  173 ) } };
             GRADIENT TRACK { { 1/2, nRGB( 198, 203, 213 ), nRGB( 219, 224, 233 ) },;
                                { 1/2, nRGB( 224, 238,237 ), nRGB( 224, 238,237 ) } };
             ROUND LINECOLORS CLR_BLACK, CLR_WHITE
             
                
   @ 210,  50 BUTTON "+" ACTION ( nActual3 := oMeter3:Set( nActual3 += 1 ) ) SIZE 25, 20 PIXEL
   @ 210,  80 BUTTON "-" ACTION ( nActual3 := oMeter3:Set( nActual3 -= 1 ) ) SIZE 25, 20 PIXEL
   @ 210, 110 BUTTON "Rst" ACTION ( nActual3 := oMeter3:Set( 0 ), oMeter3:Refresh() ) SIZE 25, 20 PIXEL
   @ 210, 140 BUTTON "Auto" ACTION ( Automatic( oMeter3, @nActual3 ) ) SIZE 70, 20 PIXEL
   @ 210, 215 CHECKBOX oMeter3:lInverted PROMPT "inverted" PIXEL SIZE 70, 12 
   @ 210, 290 CHECKBOX oMeter3:lVertical PROMPT "Vertical" PIXEL SIZE 70, 12 
   
   // meter 4 vertical
   @ 10, 380 METEREX oMeter4 VAR nActual4 SIZE 20, 200 TOTAL 50 PIXEL;
             GRADIENT TRACK { { 1/2, nRGB( 198, 203, 213 ), nRGB( 219, 224, 233 ) },;
                                { 1/2, nRGB( 224, 238,237 ), nRGB( 224, 238,237 ) } } ;
             LINECOLORS nRGB( 110, 151,204 ), CLR_WHITE;
             VERTICAL INVERTED
   
   @  10, 415 BUTTON "+" ACTION ( nActual4 := oMeter4:Set( nActual4 += 1 ) ) SIZE 25, 20 PIXEL
   @  40, 415 BUTTON "-" ACTION ( nActual4 := oMeter4:Set( nActual4 -= 1 ) ) SIZE 25, 20 PIXEL
   @  70, 415 BUTTON "Rst" ACTION ( nActual4 := oMeter4:Set( 0 ), oMeter4:Refresh() ) SIZE 25, 20 PIXEL
   @ 100, 415 BUTTON "Automatic" ACTION ( Automatic( oMeter4, @nActual4 ) ) SIZE 70, 20 PIXEL
   @ 130, 415 CHECKBOX oMeter4:lInverted PROMPT "inverted" PIXEL SIZE 70, 12 
   @ 160, 415 CHECKBOX oMeter4:lVertical PROMPT "Vertical" PIXEL SIZE 70, 12    
   
   ACTIVATE WINDOW oWnd

RETURN NIL

FUNCTION Automatic( oMeter, nActual )

   LOCAL n
   LOCAL nFrom := nActual

   FOR n = nFrom TO oMeter:nTotal step 0.001
      nActual = n
      oMeter:Set( nActual )
   NEXT
   nActual = oMeter:nTotal
   oMeter:Set( nActual )
   
RETURN NIL
 
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
toninhofwi
Posts: 161
Joined: Tue Oct 18, 2005 10:01 am

Re: Nueva Clase TMeterEx

Post by toninhofwi »

Hi Daniel.

Very nice job.

Regards,

Toninho.
User avatar
Armando
Posts: 2479
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México
Contact:

Re: Nueva Clase TMeterEx

Post by Armando »

Daniel:

Se ve fffffffffffffffffffffenomenal.

Felicitaciones al "cocinero".

Saludos
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Daniel Garcia-Gil
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita
Contact:

Re: Nueva Clase TMeterEx

Post by Daniel Garcia-Gil »

Trabajando desde recursos

Image

http://www.sitasoft.net/fivewin/samples/meterex2.zip

Code: Select all

#include "fivewin.ch"



FUNCTION MAIN
   
   LOCAL oDlg 
   LOCAL oMeter, oMeter2
   LOCAL nActual := nActual2 := 0
   
   
   DEFINE DIALOG oDlg RESOURCE "METEREX"

   REDEFINE METEREX oMeter VAR nActual ID 100 TOTAL 50 ROUND ROUNDSIZE 6
   REDEFINE BUTTON ID 101 ACTION ( nActual := oMeter:Set( nActual += 1 ) )
   REDEFINE BUTTON ID 102 ACTION ( nActual := oMeter:Set( nActual -= 1 ) )
   REDEFINE BUTTON ID 103 ACTION ( nActual := 0, oMeter:Set( 0 ) )
   REDEFINE BUTTON ID 104 ACTION ( Automatic( oMeter, @nActual ) ) 
   REDEFINE CHECKBOX oMeter:lInverted ID 105 
   REDEFINE CHECKBOX oMeter:lVertical ID 106 
   

   REDEFINE METEREX oMeter2 VAR nActual2 ID 199 TOTAL 50 VERTICAL INVERTED ;
             GRADIENT CHUNK { { 1/2, nRGB( 255, 251, 229 ), nRGB( 250, 223, 143 ) } , ;
                              { 1/2, nRGB( 244, 194,  51 ), nRGB( 252, 235,  173 ) } }
   REDEFINE BUTTON ID 200 ACTION ( nActual2 := oMeter2:Set( nActual2 += 1 ) )
   REDEFINE BUTTON ID 201 ACTION ( nActual2 := oMeter2:Set( nActual2 -= 1 ) )
   REDEFINE BUTTON ID 202 ACTION ( nActual2 := 0, oMeter2:Set( 0 ) )
   REDEFINE BUTTON ID 203 ACTION ( Automatic( oMeter2, @nActual2 ) ) 
   REDEFINE CHECKBOX oMeter2:lInverted ID 204
   REDEFINE CHECKBOX oMeter2:lVertical ID 205 


   ACTIVATE DIALOG oDlg
   
RETURN NIL
   
FUNCTION Automatic( oMeter, nActual )

   LOCAL n
   LOCAL nFrom := nActual

   FOR n = nFrom TO oMeter:nTotal step 0.001
      nActual = n
      oMeter:Set( nActual )
   NEXT
   nActual = oMeter:nTotal
   oMeter:Set( nActual )
   
RETURN NIL   
 
RC...

Code: Select all

METEREX DIALOG MOVEABLE PURE LOADONCALL DISCARDABLE 18, 18, 299, 169
STYLE DS_SETFONT |DS_MODALFRAME |WS_POPUP |WS_SYSMENU |WS_CAPTION 
CAPTION "Test Resource TMeterEx"
FONT 8, "Arial"
LANGUAGE LANG_NEUTRAL, 0
{
  CONTROL "",100,"TMETEREX",WS_CHILD |WS_VISIBLE ,17,14,265,14
  CONTROL "+",101,"BUTTON",BS_DEFPUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,17,32,25,20
  CONTROL "-",102,"BUTTON",BS_DEFPUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,48,32,25,20
  CONTROL "Rst",103,"BUTTON",BS_DEFPUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,80,32,25,20
  CONTROL "Auto",104,"BUTTON",BS_DEFPUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,109,37,50,14
  CONTROL "Inverted",105,"BUTTON",BS_CHECKBOX |BS_LEFT |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,167,29,70,10
  CONTROL "Vertical",106,"BUTTON",BS_CHECKBOX |BS_LEFT |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,167,42,70,10
  CONTROL "UserDefined",199,"TMETEREX",WS_CHILD |WS_VISIBLE ,17,62,19,102
  CONTROL "+",200,"BUTTON",BS_DEFPUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,45,63,25,20
  CONTROL "-",201,"BUTTON",BS_DEFPUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,45,85,25,20
  CONTROL "Rst",202,"BUTTON",BS_DEFPUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,45,107,25,20
  CONTROL "Auto",203,"BUTTON",BS_DEFPUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,45,129,50,14
  CONTROL "Inverted",204,"BUTTON",BS_CHECKBOX |BS_LEFT |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,83,68,70,10
  CONTROL "Vertical",205,"BUTTON",BS_CHECKBOX |BS_LEFT |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,84,81,70,10
}
 
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
User avatar
joseluisysturiz
Posts: 2024
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela
Contact:

Re: Nueva Clase TMeterEx

Post by joseluisysturiz »

Como siempre espectacular.
Dios no está muerto...

Gracias a mi Dios ante todo!
User avatar
acuellar
Posts: 1312
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: Nueva Clase TMeterEx

Post by acuellar »

Hola Daniel, muy bonito gracias.

He compilado el ejemplo con el recurso y da error de sintaxis. Para que version de Fivewin es? Tengo la 9.04

Gracias distinguido

Saludos

Adhemar
Saludos,

Adhemar C.
User avatar
Daniel Garcia-Gil
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita
Contact:

Re: Nueva Clase TMeterEx

Post by Daniel Garcia-Gil »

Hola Acuellar


estara disponible para la proxima version de FW (10.3)

gracias.
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
User avatar
acuellar
Posts: 1312
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: Nueva Clase TMeterEx

Post by acuellar »

Ok.

Gracias

Adhemar
Saludos,

Adhemar C.
User avatar
karinha
Posts: 4882
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Nueva Clase TMeterEx

Post by karinha »

Marabilloso Daniel, parabiéns!!

Regards, saludos.
João Santos - São Paulo - Brasil
User avatar
AIDA
Posts: 782
Joined: Fri Jan 12, 2007 8:35 pm

Re: Nueva Clase TMeterEx

Post by AIDA »

Hola

muy bonitos pero como lo aplico en una index

USE DATA\CIUDAD
INDEX ON CIUDAD->NOMBRE TAG "ciudad"

se puede o no se puede :?:

Saluditos :wink:
Que es mejor que programar? creo que nada :)
Atropellada pero aqui ando :P

I love Fivewin

séʌǝɹ ןɐ ɐʇsǝ opunɯ ǝʇsǝ
Marcelo Via Giglio
Posts: 1033
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Re: Nueva Clase TMeterEx

Post by Marcelo Via Giglio »

User avatar
AIDA
Posts: 782
Joined: Fri Jan 12, 2007 8:35 pm

Re: Nueva Clase TMeterEx

Post by AIDA »

Gracias por el dato pero yo no uso FwCe

lo quiero para PC

Saluditos :wink:
Que es mejor que programar? creo que nada :)
Atropellada pero aqui ando :P

I love Fivewin

séʌǝɹ ןɐ ɐʇsǝ opunɯ ǝʇsǝ
Marcelo Via Giglio
Posts: 1033
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Re: Nueva Clase TMeterEx

Post by Marcelo Via Giglio »

User avatar
Daniel Garcia-Gil
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita
Contact:

Re: Nueva Clase TMeterEx

Post by Daniel Garcia-Gil »

Aida

tomado del post de FWCE

usando meterex.... recuerda usar la DBF que viene en la carpeta sample

Code: Select all

#include "fivewin.ch"

REQUEST DBFCDX

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

Function Main()

   Local oWnd, oBtn[ 2 ], oMeter, nProg

   USE ( "customer" ) EXCLUSIVE NEW VIA "DBFCDX"

   DEFINE WINDOW oWnd TITLE "Indexing"

   @ 20, 10 BUTTON oBtn[ 1 ] PROMPT "&Index" OF oWnd SIZE 60, 20 PIXEL ;
            ACTION fIndex( oMeter )

   @ 20, 80 BUTTON oBtn[ 2 ] PROMPT "&Exit" OF oWnd SIZE 40, 20 PIXEL ;
            ACTION oWnd:End()

   @ 50,  5 METEREX oMeter VAR nProg OF oWnd SIZE 226, 20 PIXEL

   ACTIVATE WINDOW oWnd

Return Nil

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

Function fIndex( oMeter )

   Local nVar, nStep, nTotal
   Field Last, First

   If File( "Customer.cdx" )
      FErase( "Customer.cdx" )
   EndIf

   nTotal := RecCount()
   nStep := Max( Int( nTotal * .02 ), 1 ) // update meter every 2% of progress is faster than every record
   nVar := 0
   oMeter:nTotal = nTotal
   oMeter:Set( 0 )
   Index On Last + First Tag ( "LASTFIRST" ) To Customer ;
         Eval { || oMeter:Set( nVar += nStep ), SysRefresh(),  .T. } Every nStep

   oMeter:Set( nTotal )

Return Nil
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
User avatar
AIDA
Posts: 782
Joined: Fri Jan 12, 2007 8:35 pm

Re: Nueva Clase TMeterEx

Post by AIDA »

Hola Daniel

Funciona super bien :mrgreen:
y se ve muy bonito :!: :!: :!:

muchos tenquius por el ejemplo :D

Gracias :wink:
Que es mejor que programar? creo que nada :)
Atropellada pero aqui ando :P

I love Fivewin

séʌǝɹ ןɐ ɐʇsǝ opunɯ ǝʇsǝ
Post Reply