rando color

rando color

Postby Silvio.Falconi » Wed Jan 10, 2018 10:44 pm

I have an archive where I put a field ncolor ( numeric) to show a color but when I insert a record it is allways black because the fields is empty (0) .
How I can to rando a color different every time I insert a new record ?
Any nice solution ?

I made this
Code: Select all  Expand view  RUN
Function Rando_Color(nColor)
   nRed:=HB_Random(0, 255 )
   nBlue:=HB_Random(0, 255 )
   nGia:=HB_Random(0, 255 )
   nColor:= nrgb(nRed,nGia,nBlue)
   msginfo(ncolor)
      return  nColor


but I have often the same or similar color
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: 7076
Joined: Thu Oct 18, 2012 7:17 pm

Re: rando color

Postby cnavarro » Thu Jan 11, 2018 1:48 am

Try with

Code: Select all  Expand view  RUN

   ? Int( 255 * hb_Random( 0, 1 ) ), Int( 255 * hb_Random( 0, 1 ) ), Int( 255 * hb_Random( 0, 1 ) )
 
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: 6549
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: rando color

Postby Silvio.Falconi » Thu Jan 11, 2018 12:16 pm

seem run ok I add the search in archive to dbseek any clone
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: 7076
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Enrico Maria Giordano, Otto and 54 guests