Introduction
Microsoft Dynamics 365 for Finance and Operations provides many out-of-the-box controls, but even after covering a vast amount, some controls need to be implemented by our self. Among those controls is a Color picker control, which allows a user to select a color from a selection of approximate 16 million colors.
Solution
In this solution, we would be implementing a basic color picker control with the goal of looking up 16 million colors, and allowing a user to select a single one.To start, we'd create a form with the following form control:
Note that we are using a FormIntControl to specify a color picker control. An alternative to this approach is to use FormStringControl instead.
Now we will override the lookup method on Color picker control, this would allow us to view the colors in a circular wheel when the drop down button on FormIntegerControl is clicked.
public class ColorPicker extends FormRun
{
[Control("Integer")]
public void lookup()
{
int color = this.value();
color = ColorSelection::selectColor(this, color);
this.value(color);
this.backgroundColor(color);
}
}
Finally, we would run the form to view the results as:
No comments:
Post a Comment