AX / D365FO – Change the text colour of a Form field using X++

This example shows how to change the text colour of a Form control through X++ code. The color will be changed in RED TextControl.colorScheme(FormColorScheme::RGB); TextControl.foregroundColor(WinAPI::RGB2int(255,0,0)); And this will be the result If you want to convert to GREEN just modify like shown below TextControl.colorScheme(FormColorScheme::RGB); TextControl.foregroundColor(WinAPI::RGB2int(0,128,0));

AX / D365FO – How to change font size of control labels in D365 forms

Actually, the only way I found to increase Font Size of a Form Static text is to change the Style Property value of the control By default the property is set to Auto and the text appears in a normal size (like shown below) But I wanto to increase the size so I changed the … Continue reading AX / D365FO – How to change font size of control labels in D365 forms

AX / D365FO – Insert a Yes/No Message box on a Form Click Button event

While any operation is performed by the user, there are cases such as need to receive confirmation from the user to perform the operation. In these cases we can use “DialogButton” for user interaction not say “Yes/No” to perform the operation. Below is an example code public void clicked() { DialogButton diagBut; str strMessage = … Continue reading AX / D365FO – Insert a Yes/No Message box on a Form Click Button event

AX / D365FO – Check if a FormControl is of type “String”, “Date” or “numeric”

I often work with FormControls and need to understand the type of control in order to use the right properties and methods. The code below shows how to intercept the control type and cast it with the matching type public void getFormControlType(FormControl _myFormControl) { FormRealControl callingRealControl; FormStringControl callingStringControl; FormIntControl callingIntControl; FormInt64Control callingInt64Control; FormDateControl callingDateControl; switch … Continue reading AX / D365FO – Check if a FormControl is of type “String”, “Date” or “numeric”

AX / D365FO – Show “NoYes” Enum field as Combobox instead of Checkbox

I'm building a form from a table. One of its fields is a enum YesNo. I can't figure out why every time I add it to the form it appears as a checkbox instead of a combobox. I want a combobox with a lookup and inside display the values "Yes" and "No". After several attempts … Continue reading AX / D365FO – Show “NoYes” Enum field as Combobox instead of Checkbox

AX / D365FO – Avoid entering values that are not included in a lookup

I'm building a Form with a field with a lookup inside. I don't want the user to be able to enter values that are not within the range of values allowed by the lookup. How to do?A solution could be to use the validate() method signaling an error in case of an incorrect value. But … Continue reading AX / D365FO – Avoid entering values that are not included in a lookup