To help writing code for a quick report, 4D 2004 has implemented an automatic code generator in the wizard. The feature is only available in User Mode. Basically, this feature will generate 4D code for the quick report created with the quick report editor. The code can be copied and then pasted to the method editor.
During the “Finalization” step of the quick report wizard, there is a circle button that is labeled “Build 4D Code”. After clicking on the button, a dialog window will prompt that will enable the user to customize the code generation by allowing the following preferences to be altered.
Borders: Check this option to specify that you want to include the cell border properties in the generated 4D code.
Palettes visibility: Check this option to specify that you want to include the current palettes display status (Standard, Styles, Columns...) in the generated 4D code. It is advisable to deselect this option if the code is intended for use in an offscreen area.
Text properties: Use this option to specify that you want to include the font style definition of the report (font, style, etc.) in the 4D code. If this option is not checked, the three following options have no effect.
Font, Size, Justification: When this option is checked, the generated 4D code includes information regarding font, font size and font justification in the quick report template.
Style (Bold, Italic, Underline): When this option is checked, the generated 4D code includes information regarding text styles in the quick report template.
Color (Text, Background): When this option is checked, the generated 4D code includes information regarding the text colors in the quick report template. (From page 43 and 44 of 2004 upgrade reference.)
Once the preferences have been set, clicking on the “Build Code” button will generate code and it can be seen instantly in the preview area. If the code is satisfactory, then clicking on the “Paste in Clipboard” button will copy the code and allow for pasting it into a method editor or text editor. Clicking “Done” will exit from the code generator.