Color picker
From Axaptapedia
Axapta provides a ready made wrapper of the windows color picker. This article describes how it can be used:
1) Define an extended data type called MyColor with:
FormHelp = SysChooseColor
2) Define a table with a field based on the new datatype
3) Define a form based on this table.
Now the form will use for this field the standard windows color picker as a lookup. The color RGB code returned is a string of the following format:
#<red value in hex><green value in hex><blue value in hex>
Examples:
#FF0000 is red #00FF00 is green #0000FF is blue #C0C0C0 is grey
Usually most Axapta color properties will need a integer to be passed as color. To convert above string to the required integer, the follwoing function can be used:
int Str2Color(str colorStr) { int RValue, GValue, BValue; RValue = hex2int(substr(colorStr,2,2)); GValue = hex2int(substr(colorStr,4,2)); BValue = hex2int(substr(colorStr,6,2)); return (WinApi::RGB2int(RValue,GValue,BValue)); }
Enjoy,
--Markus Schmitz 06:34, 16 Jun 2005 (EDT)