I have a problem that needs some support. In a report I simulate zebra paper how it was used in earlier times. Using f3 as record counter I change the background color on every second record from white to some nice background:
f3=f3+1
report$?detail{prop:color} = 0FFF0F5H !LavenderBlush (CSS color name)
if f3 % 2 = 0 then
report$?detail{prop:color} = 0FFFFFFH !White
end
This works fine so far. Now I would like to manage the color value by using a variable which I could then set in my default settings of my app.
The problem is: I don’t know what type of variable I should use for that since in my example I am using hex constants.
If the Settings are on a Window where you would like to have an ENTRY() to type the colors, and you use a LONG as the type, then you must enter the color as an ENTRY(@n10) Long. That means you enter 16,773,215 for FFF0F5h.
Another option would be to make it a HexColor STRING(6) so you could type ‘FFF0F5’ . You must validate that it was all hex digits 0-9 A-F entered. You can convert to a Long using LongColor=EVALUATE('0' & CLIP(HexColor) & 'h' ). I would store both the STRING and the LONG in the Settings file so can use the Long color in all the code setting up colors.
I do have a Long to Hex function in the below GIST. Similar functions are in LibSrc CWUtil.clw. You could use that to store only a LONG in the file, but convert to String of hex digits for an Entry(@s6).
They look like 32bit hex values which will work fine with the 32bit long, and it looks like CSS hex which means its a hex representation of Red Green Blue (RGB) so should remain 32bit, but if it didnt and you had to have 64bit hex values, you’d need a data type for 64bit values, and then String would be an easy data type to use.
If you select the Code you paste then click the <\> icon it will be formatted as Fixed Width Font Code. It also preserves indenting and quotes so looks nicer to read.
Below is the pasted code on the Left and formatted on the Right:
Sorry for resurrecting this thread. It’s been to long since I did this stuff…
I did a color-picker on the green of this image (below) and the value is: 37614f
I have tried everything in this thread, and the color that is painted in the control is slightly off. What am I doing wrong, on how to convert this so that I can use it as the background color of a prompt?