FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour rando color
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
rando color
Posted: 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 (fw): Select all Collapse
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 March-April 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
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: rando color
Posted: Thu Jan 11, 2018 01:48 AM
Try with

Code (fw): Select all Collapse
   ? 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
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: rando color
Posted: 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 March-April 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

Continue the discussion