barra de progreso circular
barra de progreso circular
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.
¿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.
Re: barra de progreso circular
Si... así Karinha.
Sería lo ideal!!
Q clase es esa? Y como se implanta?
Gracias!!
Saludos
Loren
Sería lo ideal!!
Q clase es esa? Y como se implanta?
Gracias!!
Saludos
Loren
Re: barra de progreso circular
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
Re: barra de progreso circular
Joao, bonito proyecto para desarrollarkarinha 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.
A ver si tengo un rato y estoy inspirado, porque algunos detalles parecen un poco complicadillos de realizar.
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: barra de progreso circular
there is allready a oldest class on CD2002
TPieMeter
you could modify it
TPieMeter
you could modify it
Code: Select all
#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)
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
Re: barra de progreso circular
Silvio, este ejemplo és terrible. Mister navarro debe hacer algo +- tipo el poderoso METEREX, solo que circular, comprendes?
Saludos.
Saludos.
João Santos - São Paulo - Brasil
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: barra de progreso circular
Dear Karinha,karinha wrote:Silvio, este ejemplo és terrible. Mister navarro debe hacer algo +- tipo el poderoso METEREX, solo que circular, comprendes?
Saludos.
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
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
Re: barra de progreso circular
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.
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.
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: barra de progreso circular
Rao,
From Circular Barcode Class I sent you, can create meter circular class easy

From Circular Barcode Class I sent you, can create meter circular class easy

I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: barra de progreso circular
allready made it ...







run ok also with Transparent

Perhaps you have it on next fwh release







run ok also with Transparent

Perhaps you have it on next fwh release
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
Re: barra de progreso circular
Silvio, very good, congratulations
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
- Silvio.Falconi
- Posts: 4956
- Joined: Thu Oct 18, 2012 7:17 pm
Re: barra de progreso circular
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC