New Rating Class

Re: New Rating Class

Postby Silvio.Falconi » Sun Dec 28, 2014 12:57 pm

with this modification you see the half value but then it not show when I wish a full star value

Function OnHoverRate(select,count)
Local j

Reset(count)

FOR j:=1 TO select
img_name := "Image_"+hb_ntos(j)
&img_name:LoadBmp(Full_Img)

NEXT


SetHalf(count, select, aClicked )

nValue:= select-1
nValuePressed:= val(aRate[select])-5
cRate := str(nValuePressed,2)+"%"
oSay1:Refresh()


Return Nil
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: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: New Rating Class

Postby ukoenig » Mon Dec 29, 2014 11:30 am

Silvio,

I'm working on a modified version that works with splitted images ( 10 => 5 pairs of LEFT and RIGHT ).
The reason : a action is needed to paint a HALF star.
Clicking on the star-LEFT side, paints a HALF star.
Cicking on the star-RIGHT side, paints a LEFT and RIGHT star ( shows FULL )

The alphablended images ( 128 x 128 ) :

Image

Image

Image

Image

Code: Select all  Expand view

count := 10 // !!!

I := 1
FOR I := 1 TO count // 10
    IF nPos = 1 // paints LEFT
        @ nRow, nCol IMAGE Image[I] SIZE 6, 12 OF oDlg  ;
        FILENAME Empty_L PIXEL  NOBORDER  ADJUST CURSOR oCursorBtn ;
        ON CLICK ( pressed := I, ONSELECTRATE( pressed, count, oSay1))
        image[I]:LoadBmp( Empty_L )
        nPos := 2
    ELSE // paints RIGHT
        @ nRow, nCol IMAGE Image[I] SIZE 6, 12 OF oDlg  ;
        FILENAME Empty_R PIXEL  NOBORDER  ADJUST CURSOR oCursorBtn ;
        ON CLICK ( pressed := I, ONSELECTRATE( pressed, count, oSay1))
        image[I]:LoadBmp( Empty_R )
        nPos := 1
    ENDIF   
    Image[I]:lTransparent := .T.
    nCol += 6 // one image = half star-size
    Image[I]:bMMoved:= { || ( pressed := I, ONHOVERRATE( pressed, count)) }
    Image[I]:bMLeave :={ || ( pressed := I, ONLEAVERATE( pressed, count, oSay1)) }
NEXT
 


Image

clicked on the RIGHT part of the empty 5. star

Image

clicked on the LEFT part of the empty 4. star ( paints LEFT full )

Image

best regards
Uwe :lol:
Last edited by ukoenig on Sat Jan 03, 2015 3:30 pm, edited 1 time in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: New Rating Class

Postby ukoenig » Mon Dec 29, 2014 8:53 pm

Silvio,

I finished testing this solution showing HALF stars and added a style-test
Is it a option, working with splitted images ?
Changing the style, the selected value is saved to a INI and restarts with the new selected style.
The same works on EXIT.

Download ( all style-images are included ) :
http://www.pflegeplus.com/DOWNLOAD/Rating1.zip

Image

I would like, to include this part in the FOR / NEXT.
Is it possible ?


[color=#0000FF]oImage[1]:bMMoved := { || ONHOVERRATE( 1, nCount ) }
oImage[1]:bMLeave :={ || ONLEAVERATE( 1, nCount, oSay1 ) }

oImage[2]:bMMoved := { || ONHOVERRATE( 2, nCount ) }
oImage[2]:bMLeave :={ || ONLEAVERATE( 2, nCount, oSay1 ) }
...
...

Code: Select all  Expand view


I := 1
FOR I := 1 TO nCount
    IF nPos = 1
        @ nRow, nCol IMAGE oImage[I] SIZE 6, 12 OF oDlg  ;
        FILENAME Empty_L PIXEL  NOBORDER  ADJUST CURSOR oCursorBtn ;
        oImage[I]:LoadBmp( Empty_L )
        nPos := 2
    ELSE
        @ nRow, nCol IMAGE oImage[I] SIZE 6, 12 OF oDlg  ;
        FILENAME Empty_R PIXEL  NOBORDER  ADJUST CURSOR oCursorBtn ;
        oImage[I]:LoadBmp( Empty_R )
        nPos := 1
    ENDIF   
    oImage[I]:lTransparent := .T.
    nCol += 6
    // NOT WORKING !!!
    // oImage[I]:bMMoved := { || ONHOVERRATE( I, nCount ) }
    // oImage[I]:bMLeave :={ || ONLEAVERATE( I, nCount, oSay1 ) }
NEXT

oImage[1]:bMMoved := { || ONHOVERRATE( 1, nCount ) }
oImage[1]:bMLeave :={ || ONLEAVERATE( 1, nCount, oSay1 ) }

oImage[2]:bMMoved := { || ONHOVERRATE( 2, nCount ) }
oImage[2]:bMLeave :={ || ONLEAVERATE( 2, nCount, oSay1 ) }
...
...

 


best regards
Uwe :?:
Last edited by ukoenig on Sat Jan 03, 2015 3:31 pm, edited 3 times in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: New Rating Class

Postby Silvio.Falconi » Mon Dec 29, 2014 10:11 pm

Good...Uwe
Perhaps this seem the good solution
5 stars with each 4 bitmap ?
I think only the final user can Know wich type of Bitmap he want
can you create a source with one type to understand how make a class control

the bitmaps are only 4 ?


Antonio,
How we can converte it into a class control ?
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: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: New Rating Class

Postby ukoenig » Mon Dec 29, 2014 10:19 pm

Silvio,
these bitmaps are used :
( cStyle defines the used star-type and is saved to the INI )

Left / Right for EMPTY and Left / Right for FULL

Empty_L := c_path1 + "Empty" + cStyle + "_L.bmp"
Empty_R := c_path1 + "Empty" + cStyle + "_R.bmp"
Full_L := c_path1 + "Full" + cStyle + "_L.bmp"
Full_R := c_path1 + "Full" + cStyle + "_R.bmp"

Just test it with the Download-files, EXE is included

I changed the image-display ( 6 ) for the radio :
Code: Select all  Expand view

I := 1
nTop := 5
nStar := 1
FOR I := 1 TO 6
     cStar := LTRIM(STR(nStar))
     @ nTop, 160 IMAGE oStar[I] SIZE 10, 20 OF oDlg  ;
     FILENAME c_path1 + "Full" + cStar + "_L.bmp" PIXEL  NOBORDER  ADJUST
     oStar[I]:LoadBmp( c_path1 + "Full" + cStar + "_L.bmp" )
     oStar[I]:lTransparent := .T.
     nTop += 20
     cStar := LTRIM(STR(nStar))
     nStar++
NEXT
 


best regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: New Rating Class

Postby ukoenig » Tue Dec 30, 2014 2:13 pm

Silvio,

I added some new functions :

1. full size-display of images from radio
2. new image-styles
3. the 7 images are defined in a FOR / NEXT
4. a click on a selection ( mousemove ) will freeze the result
until You select the button Reset :

lSelected := .F. // imagepainting on mousemove enabled

@ nRow, nCol IMAGE oImage[I] SIZE 6, 12 OF oDlg ;
FILENAME Empty_L PIXEL NOBORDER ADJUST CURSOR oCursorBtn ;

ON CLICK lSelected := .T.
// the NEW var will DISABLE paintings on mousemove

added :

STATIC FUNCTION RESET( nCount )
...
...
lSelected := .F. // enables new painting
...
...
RETURN NIL

Download ( all style-images are included ) :
http://www.pflegeplus.com/DOWNLOAD/Rating2.zip

Image

best regards
Uwe :)
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: New Rating Class

Postby Antonio Linares » Tue Dec 30, 2014 5:35 pm

Uwe,

Fantastic! ;-)
regards, saludos

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

Re: New Rating Class

Postby Silvio.Falconi » Wed Dec 31, 2014 3:58 pm

Antonio,
Can we converte it onto a control ?
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: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: New Rating Class

Postby ukoenig » Sat Jan 03, 2015 3:33 pm

A EXTENDED release with background-selection ( testing transparent ) :

1. Color
2. Gradient horiz.
3. Gradient vert
4. Image-brush
5. Selected textcolor

Download ( some new images are included ) :
http://www.pflegeplus.com/DOWNLOAD/Rating3.zip

Image

Image

Image

best regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: New Rating Class

Postby antolin » Sat Jan 03, 2015 8:16 pm

Silvio, try one of theses solutions for half stars:
Code: Select all  Expand view
FUNCTION PolyForms(nX,nY,nWidth,nHeight,nLados,nGiro,nPorC, lHalf)  // MODIFIED
   LOCAL aVert
   LOCAL nRadV := nHeight/2
   LOCAL nRadH := nWidth/2
   LOCAL nAngl := (2*PI)/nLados
   LOCAL nAngu,nOAng
   LOCAL nCount,nStep
LOCAL nSides := IF(lHalf,Int(nLados/2),nLados)  // NEW

   DEFAULT nGiro := 0 , ;
       nPorC := 100
   *
   nPorc := Max(0,Min(100,nPorC))
   nAngu := (nGiro*PI)/180
   IF nPorC = 100
      aVert := Array(nLados+1,2)
      nStep := 1
   ELSE
      aVert := Array((nLados*2)+1,2)
      nStep := 2
      nOAng := nAngl/2
      nLados:= nLados*2
      nPorC := 9.9+(nPorC*0.9)
   ENDIF
   *
FOR nCount = 1 TO nSides STEP nStep // MODIFIED
       aVert[nCount] := { nY+nRadH+(nRadH*Cos(nAngu)), nX+nRadV+(nRadV*Sin(nAngu)) }
       IF nPorC < 100
      aVert[nCount+1] := { nY+nRadH+(nRadH*(nPorC/100)*Cos(nAngu+nOAng)), ;
                   nX+nRadV+(nRadV*(nPorC/100)*Sin(nAngu+nOAng))  }
       ENDIF
       nAngu += nAngl
   NEXT
   aVert[nLados+1] := aVert[1]
RETURN aVert

OR

FUNCTION PolyForms(nX,nY,nWidth,nHeight,nLados,nGiro,nPorC, lHalf)  // MODIFIED
   LOCAL aVert
   LOCAL nRadV := nHeight/2
   LOCAL nRadH := nWidth/2
   LOCAL nAngl := (2*PI)/nLados
   LOCAL nAngu,nOAng
   LOCAL nCount,nStep
LOCAL nSatrt := IF(lHalf,Int(nLados/2),1)   // NEW

   DEFAULT nGiro := 0 , ;
       nPorC := 100
   *
   nPorc := Max(0,Min(100,nPorC))
   nAngu := (nGiro*PI)/180
   IF nPorC = 100
      aVert := Array(nLados+1,2)
      nStep := 1
   ELSE
      aVert := Array((nLados*2)+1,2)
      nStep := 2
      nOAng := nAngl/2
      nLados:= nLados*2
      nPorC := 9.9+(nPorC*0.9)
   ENDIF
   *
FOR nCount = nStart TO nLados STEP nStep    // MODIFIED
       aVert[nCount] := { nY+nRadH+(nRadH*Cos(nAngu)), nX+nRadV+(nRadV*Sin(nAngu)) }
       IF nPorC < 100
      aVert[nCount+1] := { nY+nRadH+(nRadH*(nPorC/100)*Cos(nAngu+nOAng)), ;
                   nX+nRadV+(nRadV*(nPorC/100)*Sin(nAngu+nOAng))  }
       ENDIF
       nAngu += nAngl
   NEXT
   aVert[nLados+1] := aVert[1]
RETURN aVert

If it runs, first paint an half star without pen, then, in the same position, an empty star with pen.
Perhaps you must use FOR nCount = nStart+1 TO nLados STEP nStep or FOR nCount = nStart-1 TO nLados STEP nStep, i don't know. I don't have tested it.

I hope that runs.

Excuse my English.
Peaaaaaso de foro...
FWH 2007 - xHarbour - BCC55
antolin
 
Posts: 498
Joined: Thu May 10, 2007 8:30 pm
Location: Sevilla

Re: New Rating Class

Postby Silvio.Falconi » Sat Jan 03, 2015 8:28 pm

Antolin,
on first beta class I thinked to use your function
Then I thinked yto use Bmps because the user can insert all bitmaps he wants
If you wish help me go at viewtopic.php?f=3&t=29903
I hope you help me
Regards
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: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: New Rating Class

Postby antolin » Sat Jan 03, 2015 8:37 pm

Ups. I forgot a lot of changes. These have to run better (sorry):

Code: Select all  Expand view
FUNCTION PolyForms(nX,nY,nWidth,nHeight,nLados,nGiro,nPorC, lHalf)  // MODIFIED
   LOCAL aVert
   LOCAL nRadV := nHeight/2
   LOCAL nRadH := nWidth/2
   LOCAL nAngl := (2*PI)/nLados
   LOCAL nAngu,nOAng
   LOCAL nCount,nStep
LOCAL nSides := IF(lHalf,Int(nLados/2),nLados)  // NEW

   DEFAULT nGiro := 0 , ;
       nPorC := 100
   *
   nPorc := Max(0,Min(100,nPorC))
   nAngu := (nGiro*PI)/180
   IF nPorC = 100
      aVert := Array(nSides+1,2)    // MODIFIED
      nStep := 1
   ELSE
      aVert := Array((nSides*2)+1,2)    // MODIFIED
      nStep := 2
      nOAng := nAngl/2
      nSide := nSide*2          // MODIFIED
      nPorC := 9.9+(nPorC*0.9)
   ENDIF
   *
FOR nCount = 1 TO nSides STEP nStep // MODIFIED
       aVert[nCount] := { nY+nRadH+(nRadH*Cos(nAngu)), nX+nRadV+(nRadV*Sin(nAngu)) }
       IF nPorC < 100
      aVert[nCount+1] := { nY+nRadH+(nRadH*(nPorC/100)*Cos(nAngu+nOAng)), ;
                   nX+nRadV+(nRadV*(nPorC/100)*Sin(nAngu+nOAng))  }
       ENDIF
       nAngu += nAngl
   NEXT
   ATail(aVert) := aVert[1]
RETURN aVert

OR

FUNCTION PolyForms(nX,nY,nWidth,nHeight,nLados,nGiro,nPorC, lHalf)  // MODIFIED
   LOCAL aVert
   LOCAL nRadV := nHeight/2
   LOCAL nRadH := nWidth/2
   LOCAL nAngl := (2*PI)/nLados
   LOCAL nAngu,nOAng
   LOCAL nCount,nStep
LOCAL nSides := IF(lHalf,Int(nLados/2),nLados)  // NEW
LOCAL nStart := IF(lHalf,Int(nLados/2)+1,1) // NEW MODIFIED
LOCAL nQ := 1                   // NEW

   DEFAULT nGiro := 0 , ;
       nPorC := 100
   *
   nPorc := Max(0,Min(100,nPorC))
   nAngu := (nGiro*PI)/180
   IF nPorC = 100
      aVert := Array(nSides+1,2)    // MODIFIED
      nStep := 1
   ELSE
      aVert := Array((nSides*2)+1,2)    // MODIFIED
      nStep := 2
      nOAng := nAngl/2
      nLados:= nLados*2
      nPorC := 9.9+(nPorC*0.9)
   ENDIF
   *
FOR nCount = nStart TO nLados STEP nStep    // MODIFIED
       aVert[nQ] := { nY+nRadH+(nRadH*Cos(nAngu)), nX+nRadV+(nRadV*Sin(nAngu)) } // MODIFIED
       IF nPorC < 100
      aVert[nQ+1] := { nY+nRadH+(nRadH*(nPorC/100)*Cos(nAngu+nOAng)), ; // MODIFIED
                   nX+nRadV+(nRadV*(nPorC/100)*Sin(nAngu+nOAng))  }
       ENDIF
       nAngu += nAngl
       ++nQ     // ADDED
   NEXT
   ATail(aVert) := aVert[1]
RETURN aVert


Best regards.
Peaaaaaso de foro...
FWH 2007 - xHarbour - BCC55
antolin
 
Posts: 498
Joined: Thu May 10, 2007 8:30 pm
Location: Sevilla

Re: New Rating Class

Postby antolin » Sat Jan 03, 2015 8:38 pm

ok Silvio.
Peaaaaaso de foro...
FWH 2007 - xHarbour - BCC55
antolin
 
Posts: 498
Joined: Thu May 10, 2007 8:30 pm
Location: Sevilla

Re: New Rating Class

Postby ukoenig » Wed Jan 07, 2015 1:05 am

Added a config dialog and changed from INI to DBF
Now it is possible to use / scan any cover size.
Define as many books, DVD-covers or any other You like.
( I will add some DVD-covers for the new download )
The displayed image on the main dialog keeps the aspect ratio ( calculated ).
Each book can have his own dialog-background and symbol.
I Moved the symbol-selection to the config dialog and
added fields < percent >, < total > and < ratings > for statistic-calculation.
These values are counted in the main-dialog.
The < Reset-button > will set all values to 0.
I still have to check the calculation for the correct graph-display.
The col < Graph > uses one image size, to display the first star at col-bottom.
I would prefer, to display a image at col-bottom and calculate the image-hight.
For the graph, I'm using only stars, otherwise there will be to many images.

Image

best regards
Uwe :D
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: New Rating Class

Postby Silvio.Falconi » Wed Jan 07, 2015 8:32 am

Sorry,
I need a control to insert to a my app, I cannot use many and many function...
Perhaps you not uderstood what i need...
I ask your Help to create the class , (viewtopic.php?f=3&t=29903 )
If it is not possible,... I must use only a numeric get !!!
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: 7061
Joined: Thu Oct 18, 2012 7:17 pm

PreviousNext

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 84 guests