barra de progreso circular

barra de progreso circular

Postby Loren » Tue Aug 27, 2019 11:37 am

buenas tardes:

¿Sabeis como mostrar una barra de progreso circular al estilo WhatsApp cuando se descargan imágenes? y lo ideal sería introducir el porcentaje de progreso en el interior del círculo.

Gracias.
saludos.
LORENZO.
Loren
 
Posts: 479
Joined: Fri Feb 16, 2007 10:29 am
Location: Cadiz - España

Re: barra de progreso circular

Postby Compuin » Tue Aug 27, 2019 11:42 am

+
FWH 20.12
Hbmk2 32/64 Bits (Build 19.29.30133)
Microsoft Visual C 32 Bits
MySql 8.0.24 32/64 Bits
VS Code
Compuin
 
Posts: 1213
Joined: Tue Dec 28, 2010 1:29 pm
Location: Quebec, Canada

Re: barra de progreso circular

Postby karinha » Tue Aug 27, 2019 1:48 pm

Asi?

+ 1

Image

Saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7214
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: barra de progreso circular

Postby Loren » Tue Aug 27, 2019 5:52 pm

Si... así Karinha.
Sería lo ideal!!
Q clase es esa? Y como se implanta?
Gracias!!
Saludos
Loren
Loren
 
Posts: 479
Joined: Fri Feb 16, 2007 10:29 am
Location: Cadiz - España

Re: barra de progreso circular

Postby karinha » Tue Aug 27, 2019 6:17 pm

Loren wrote:Si... así Karinha.
Sería lo ideal!!
Q clase es esa? Y como se implanta?
Gracias!!
Saludos
Loren



Que yo sepa, esto aun no ejiste en FiveWin the best.

Mister Navarro... És con usted.

Saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7214
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: barra de progreso circular

Postby cnavarro » Wed Aug 28, 2019 10:48 pm

karinha wrote:
Loren wrote:Si... así Karinha.
Sería lo ideal!!
Q clase es esa? Y como se implanta?
Gracias!!
Saludos
Loren



Que yo sepa, esto aun no ejiste en FiveWin the best.

Mister Navarro... És con usted.

Saludos.


Joao, bonito proyecto para desarrollar
A ver si tengo un rato y estoy inspirado, porque algunos detalles parecen un poco complicadillos de realizar.
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: barra de progreso circular

Postby Silvio.Falconi » Thu Aug 29, 2019 12:09 am

there is allready a oldest class on CD2002

TPieMeter

you could modify it


Code: Select all  Expand view




#include "FiveWin.ch"

#define CLR_BLANCO_HUESO RGB( 255, 255, 235 ) // ideal como fondo para escritura de texto

FUNCTION uPieMeter_test( oWnd )

   local Self
   local lEnd := .f.
   local n, nTotal := 10000
   local cSay := "( Este es un texto largo guardado en  ::cSay )"

   Self := TPieMeter():New( nTotal, cSay, oWnd, @lEnd )

   For n := 0 To ::nTotal
      ::Set( n )
      SysRefresh()
      If lEnd
         Exit ///
      End
   Next
   lEnd := .f.

   ::SetSay( 'Texto corto' )
   ::SetTotal( ::nTotal / 11 )

   For n := ::nTotal To 0 Step -1
      ::Set( n )
      SysRefresh()
      If lEnd
         Exit ///
      End
   Next


   oWnd:End()

RETURN NIL



CLASS TPieMeter

   DATA oWnd, oDlg, oFont, oSay, oSayPercent
   DATA nSet, nTotal, nColorLeft, nColorRight
   DATA cSay
//                                @
   METHOD New( nTotal, cSay, oWnd, lEnd )  CONSTRUCTOR
   METHOD End() INLINE ::oFont:End(), ::oDlg:End(), .T.

   METHOD Set( nSet )
   METHOD CircularSector( lLeftCircularSector, nColor )

   METHOD SetSay( cNewSay )
   METHOD SetTotal( nNewTotal )

ENDCLASS
//                             @
METHOD New( nTotal, cSay, oWnd, lEnd ) CLASS TPieMeter

   #ifdef __XPP__
      #undef New
   #endif

   local nBtnSide := 021
   local cFontName := GetSysFont() // o bien "Ms Sans Serif" // o bien "Arial" // ...

   DEFAULT cSay := ''
   DEFAULT oWnd := GetWndDefault()
   ::oWnd := oWnd

   ::nColorLeft  := CLR_HBLUE // CLR_HCYAN // CLR_HBLUE // CLR_HGREEN // CLR_HBLUE
   ::nColorRight := CLR_HGRAY // CLR_HGRAY // CLR_CYAN  // CLR_GREEN  // CLR_BLUE

   ::nSet   := 0
   ::nTotal := nTotal

   DEFINE FONT ::oFont  ;
      NAME cFontName    ;
      SIZE 000, -017

   DEFINE DIALOG ::oDlg             ;
      FROM 000, 000 TO 299, 599     ; // 300 * 600
      PIXEL                         ;
      COLORS CLR_BLACK , CLR_GRAY   ;
      WINDOW ::oWnd                 ; // si oWnd es una frame window, oDlg no modal está casi tan ligado a ella como si fuese una ventana MDI child
      STYLE nOr( WS_POPUP , DS_MODALFRAME ) // sin barra de título, con bonito borde

   ACTIVATE DIALOG ::oDlg  ;
      CENTERED             ;
      NOWAIT //

   @ 000, ::oDlg:nRight - nBtnSide BUTTON "X";
      OF  ::oDlg                             ;
      PIXEL                                  ;
      SIZE nBtnSide, nBtnSide                ;
      ACTION lEnd := .T.

   ::SetSay( cSay )

   ::SetTotal( nTotal ) // ejecuta  ::Set( 0 )

RETURN Self

METHOD SetSay( cNewSay ) CLASS TPieMeter

   ::cSay := cNewSay

   If ::oSay != NIL
      ::oSay:End()
      SysRefresh()
      ::oSay := NIL
   End
   @ 000, 000 SAY ::oSay VAR ::cSay          ;
      PIXEL                                  ;
      OF ::oDlg                              ;
      COLORS CLR_BLACK , CLR_BLANCO_HUESO    ;
      FONT ::oFont                           ;
      CENTER

   ::oSay:SetSize( ::oSay:GetWidth( ::cSay, ::oFont ), ;
                   nTextHeight( Self ) )

RETURN NIL

METHOD SetTotal( nNewTotal ) CLASS TPieMeter

   ::nTotal := nNewTotal

   If ::oSayPercent != NIL
      ::oSayPercent:End()
      SysRefresh()
      ::oSayPercent := NIL
   End
   @ nTextHeight( Self ), 000 SAY ::oSayPercent  ;
          VAR cSayPercent( Self, ::nSet )    ;
      PIXEL                                  ;
      OF ::oDlg                              ;
      COLORS CLR_BLACK , CLR_BLANCO_HUESO    ;
      FONT ::oFont                           ;
      CENTER
   ::oSayPercent:SetSize( ::oSayPercent:GetWidth( cSayPercent( Self, ::nTotal ), ::oFont ), ;
                          nTextHeight( Self ) )

   ::Set( 0 )

RETURN NIL

METHOD Set( nSet ) CLASS TPieMeter

   local lLeftCircularSector := .t.

   ::nSet := nSet

   ::CircularSector(  lLeftCircularSector, ::nColorLeft )
   ::CircularSector( !lLeftCircularSector, ::nColorRight )

   ::oSay:Refresh()
   ::oSayPercent:Refresh()

RETURN NIL

METHOD CircularSector( lLeftCircularSector, nBrushColor ) CLASS TPieMeter

   local lOk
   local hDC, hPen, hBrush, hOldPen, hOldBrush, nWidthPen := 001
// local nPenColor := nXor( nBrushColor, CLR_WHITE ) // que sea el pen de color inverso al brush
   local nPenColor := nBrushColor
   local nTopRect := 000, nLeftRect := 000
   local nBottomRect := ::oDlg:nBottom * 2
   local nRightRect  := ::oDlg:nRight
   local nDegreds    := 180 * ::nSet / ::nTotal
   local nY0, nX0, nY, nX
   local nStartCol, nStartRow, nEndCol, nEndRow

// Evitemos los 0º y los 180º, por verse un feo efecto de parpadeo con esos ángulos extremos.-
   If     nDegreds <  1
          nDegreds := 1
   ElseIf nDegreds >  179
          nDegreds := 179
   End

   nY0 := nBottomRect / 2
   nX0 := nRightRect  / 2
   nY  := ( 1 - nSeno(   nDegreds ) ) * nY0
   nX  := ( 1 - nCoseno( nDegreds ) ) * nX0

   ::oDlg:GetDC() // carga en  ::oDlg:hDC  el handle del Device Context
   hDC := ::oDlg:hDC

   hPen      := CreatePen( PS_SOLID, nWidthPen, nPenColor )
   hOldPen   := SelectObject( hDC, hPen )
   hBrush    := CreateSolidBrush( nBrushColor )
   hOldBrush := SelectObject( hDC, hBrush )
   If lLeftCircularSector
      nStartRow := nY
      nStartCol := nX
      nEndRow   := nBottomRect / 2
      nEndCol   := nLeftRect
   Else
      nStartRow := nBottomRect / 2
      nStartCol := nRightRect
      nEndRow   := nY
      nEndCol   := nX
   End
   lOk := Pie( hDC, nTopRect, nLeftRect, nBottomRect, nRightRect, ;
               nStartRow, nStartCol, nEndRow, nEndCol ) // dibuja de derecha a izquierda
// lOk := Chord( hDC, nTopRect, nLeftRect, nBottomRect, nRightRect, ;
//               nStartRow, nStartCol, nEndRow, nEndCol ) // ¡no!
   selectObject( hDC, hOldPen )
   selectObject( hDC, hOldBrush )
   DeleteObject( hPen )
   DeleteObject( hBrush )

   ::oDlg:ReleaseDC()

   If !lOk
      ?'La función  Pie()  ha fallado'
   End

RETURN NIL

static FUNCTION cSayPercent( Self, nSet )

   local cPercent  := cValToChar( Int( 100 * nSet / ::nTotal + 0.5 ) )
   local cSetTotal := cValToChar( Int( nSet ) ) + ' / ' + cValToChar( Int( ::nTotal ) )

RETURN ( cPercent + '%' + Space( 5 ) + cSetTotal )

static FUNCTION nTextHeight( Self )
RETURN ( ::oFont:nHeight * 1.3 )


   static FUNC PI(); RETURN (3.1415926536)

static FUNC RadToDeg(x); RETURN (180.0*x/PI())

static FUNC DegToRad(x); RETURN (x*PI()/180.0)

static FUNC Signo(nValue)
RETURN (IF(nValue<0, -1.0, 1.0))

static FUNC nseno(nAngle,lRad)
   LOCAL nPower, nSquare, nCont, lMinus
   LOCAL nHalfs:=0, nDouble, nFact:=1
   LOCAL nSin, nSin0, nQuadrant
   lRad:=IF(lRad=nil,.F.,lRad)
   nAngle:=Angle360(nAngle,lRad,@nQuadrant)
   nAngle:=Abs(nAngle)
   nAngle:=IF(lRad,nAngle,DegToRad(nAngle))
   DO WHILE nAngle>=0.001
     nAngle/=2
     nHalfs++
   ENDDO
   nPower:=nAngle
   nSquare:=nAngle^2
   nSin:=nPower
   lMinus:=.T.
   nCont:=1
   DO WHILE .T.
     nSin0:=nSin
     nPower*=nSquare
     nFact*=(nCont+1)*(nCont+2)
     nSin+=IF(lMinus,-1,+1)*nPower/nFact
     IF Abs(nSin-nSin0)<10^-10
       EXIT
     ENDIF
     nCont+=2
     lMinus:=!lMinus
   ENDDO
   FOR nDouble:=1 TO nHalfs
     nSin:=2*nSin*(1-nSin^2)^(1/2)
   NEXT
RETURN (Round(IF(nQuadrant>=3,-1.0,1.0)*nSin,6))

static FUNC ncoseno(nAngle,lRad)
   LOCAL nQuadrant, lMinus
   Angle360(nAngle,lRad,@nQuadrant)
   lMinus:=(nQuadrant=2) .or. (nQuadrant=3)
RETURN (Round(IF(lMinus,-1.0,1.0)*(1.0-Sin(nAngle,lRad)^2)^0.5,6))

static FUNC Angle360(nAngle,lRad,nQuadrant)
   LOCAL nAngInt, nAngFrac, nSigno:=Signo(nAngle)
   lRad:=IF(lRad=nil,.F.,lRad)
   nAngle:=Abs(nAngle)
   nAngle:=IF(lRad,RadToDeg(nAngle),nAngle)
   nAngInt:=Int(nAngle); nAngFrac:=nAngle-nAngInt
   nQuadrant:=Int(nAngInt/90)%4+1
   IF nSigno<0
     nQuadrant:=5-nQuadrant
   ENDIF
   nAngle:=nAngInt%360+nAngFrac
   nAngle:=IF(lRad,DegToRad(nAngle),nAngle)
RETURN (nSigno*nAngle)

 
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6772
Joined: Thu Oct 18, 2012 7:17 pm

Re: barra de progreso circular

Postby karinha » Thu Aug 29, 2019 12:03 pm

Silvio, este ejemplo és terrible. Mister navarro debe hacer algo +- tipo el poderoso METEREX, solo que circular, comprendes?

Saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7214
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: barra de progreso circular

Postby Silvio.Falconi » Thu Aug 29, 2019 2:47 pm

karinha wrote:Silvio, este ejemplo és terrible. Mister navarro debe hacer algo +- tipo el poderoso METEREX, solo que circular, comprendes?

Saludos.


Dear Karinha,
I didn't create this terrible example BUT your Latin or Brazilian comrades, this source is included in a zipped file that was called utility 2002 where I got many ideas. In fact when we did the circular bar codes I got the point from this source

Querido Karinha
No creé este terrible ejemplo, PERO sus camaradas latinos o brasileños, esta fuente está incluida en un archivo comprimido llamado utilidad 2002, donde obtuve muchas ideas. De hecho, cuando hicimos los códigos de barras circulares, obtuve el punto de esta fuente

este podría ser un buen comienzo para comenzar

Saludos
Saludos
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6772
Joined: Thu Oct 18, 2012 7:17 pm

Re: barra de progreso circular

Postby Loren » Wed Sep 04, 2019 8:06 am

buenos días:

Por favor, Mr Rao / Mr Navarro:
¿Sería posible, por favor, disponer de un meter circular? Están de moda, son muy visibles y mejoran la apariencia de nuestros programas

Mil gracias.
LORENZO.
Loren
 
Posts: 479
Joined: Fri Feb 16, 2007 10:29 am
Location: Cadiz - España

Re: barra de progreso circular

Postby Silvio.Falconi » Wed Sep 04, 2019 8:45 am

Rao,
From Circular Barcode Class I sent you, can create meter circular class easy
Image
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6772
Joined: Thu Oct 18, 2012 7:17 pm

Re: barra de progreso circular

Postby Silvio.Falconi » Sat Sep 07, 2019 8:05 am

allready made it ...

Image
Image
Image


Image
Image
Image
Image

run ok also with Transparent

Image

Perhaps you have it on next fwh release
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6772
Joined: Thu Oct 18, 2012 7:17 pm

Re: barra de progreso circular

Postby cnavarro » Sat Sep 07, 2019 10:28 am

Silvio, very good, congratulations
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: barra de progreso circular

Postby Silvio.Falconi » Mon Sep 09, 2019 7:53 pm

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6772
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 83 guests