Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP60- Speed
Message
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00412488
Message ID:
00412663
Views:
16
>F.e. Keyboard str(rgb(192,192,192))
>
>or simply ? rgb(192,192,192)
>

Why not _cliptext = str(rgb(192,192,192))

I often store the value of GETCOLOR() for later use; it's more convenient than storing the RGB values, since GETCOLOR() takes a color number as an argument rather than the 3 RGB numbers.

FWIW, on a PII/400, W2K, 192MB, IE 5.5 and VFP running, 10,000,000 iterations comparing assigning a variable containing an RGB() number to a variable as opposed to assigning the result of RGB() each time, assigning the RGB() took 1 second longer; the following was the test:
set talk off
nstart = datetime()
a=rgb(192,192,192)
for i = 1 to 10000000
  b = a
endfor
? datetime() - nstart  && 15
nstart = datetime()
for i = 1 to 10000000
  b = rgb(192,192,192)
endfor
? datetime() - nstart  && 16
I think that's a pretty clear indication that the function invocation time is nearly inconsequential in most situations. The RGB() has an advantage from the standpoint of readability of the code; a call to RGB() conveys the idea that a color is being referenced. A constant needs further clarification -it's easier to understand RGB_STANDARD_GREY than RGB(192,192,192), and both are clearer than 12632256. In fact, if it's going to be used as a constant, I'd tend to #DEFINE it, so that the next person in line can figure out what I did.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform