posted 02-19-2008 01:40 PM
The <<<DESC>>> section comes first:ie.
code:
<<<DESC>>>
Custom Control #2
<<<END>>>
This is the Description of the control which will appear in the Custom Control properties dialog drop down list of controls. The description will first be preceded (in the drop down list) by the controls actual Class name, which is defined in the <<<CLASS>>> section.
ie.
code:
<<<CLASS>>>
MY_CUSTOM_CTRL2
<<<END>>>
This must be the actual class name which is used in the EZLIB_AddControl function call in the generated source code.
Next comes the name of the DLL the control is in. This is defined in the <<<DLL>>> section.
ie.
code:
<<<DLL>>>
cusctrl2.dll
<<<END>>>
The controls DLL must be copied into the same folder as the EZGUI Dialog Designer for this to work.
Do not define a path to the DLL ! Just its name.
Next comes the <<<INCLUDES>>> section.
ie.
code:
<<<INCLUDES>>>
#INCLUDE "cusctrl2.INC"
<<<END>>>
This section defines the actual code to be generated in the includes section of your application for the include files necessary for the control. This must be valid PB code and must have a valid path if the include is not in a folder where the compiler can find it.
Next comes the <<<STYLES>>> section:
ie.
code:
' Property Character|Style|Style Numeric Value
' or
' Property Character|Style Description|Style|Style Numeric Value
' maximum of 30 styles allowed
' Extended styles must have [EX} before value
<<<STYLES>>>
B|Border|%WS_BORDER|&H800000&
T|Tabstop|%WS_TABSTOP|&H10000&
S|Sunken Edge|%WS_EX_CLIENTEDGE|[EX]&H00000200&
C|Caption|%WS_CAPTION|&H00C00000&
<<<END>>>
You will notice that there is some text in front of this section. For all sections, any text out of a section (not between section Macros and the <<<END>> macro, is ignored, so it can be used for adding comments.
This section is critical in that it defines all the properties of the control. The properties are simply window styles used by the control. You define each Style(property) with a line with four parameters. The parameters are separated by the | character.
The first parameter is simply a letter, number or any other character to be used as the property Name. Similiar to how the EZGUI Dialog Designer uses a single character for properties, you must define a single character for each window style you put in this section and no two can be the same. They must be unique. It is best to use a character which is the first word of the description or in some other ways makes sense (ie. T for tabstop).
This character will appear in the Custom Controls property dialogs property list.
The second parameter is the description of the property or style. This will also appear in the Custom Controls dialog (after the first parameter) in a line of the properties listbox of the dialog.
The third parameter is for code generation. It must be a valid constant. It must be valid PB code ! This parameter will be OR'ed with all the others used in the generated code in the EZLIB_AddControl library function in generated code.
The last parameter is the actual value of third paremeter. It can not be a constant, but should be a hex number (ie. &H10000). The Designer uses this value when creating the control, since it does not know what a constant value would be.
You can have up to 31 properties (styles) for the control.
Next, if the control must be registered to be used via a function call (some controls are registered simply by loading the DLL so this may not be needed), you must add the <<<REGISTER>>> section.
ie.
code:
<<<REGISTER>>>
REGISTERMyCLASS|"EGRID32"
<<<END>>>
This is not for generated code, but is the actual call made by the designer. Notice the syntax is not like PB code. The syntax is as follows:
FunctionName
or
FunctionName|"sometext"
or
FunctionName|#####
(where #### is a valid number)
The Designer only supports the above parameter syntaxes noted above.
The next three sections are quite simple:
code:
<<<USECOLORMSG>>>
NO
<<<END>>>
<<<USEFONTMSG>>>
NO
<<<END>>
<<<DEFAULTTEXT>>>
50,100
<<<END>>>
The <<<USECOLORMSG>>> section simply defines whether the control responds the WM_COLORCTLxxx style messages. If it does, put YES, otherwise put NO
The <<<USEFONTMSG>>> section simply defines whether the control responds to the WM_SETFONT message. Again, if it does, put YES, otherwise put NO
The <<<DEFAULTTEXT>>> section defines whether the control uses the Text parameter of the EZLIB_AddControl function call to pass the default text. If it does, put some valid text here, otherwise leave it blank.
Lastly, the <<<INITCODE>>> section. This defines code which will be generated in EZ_Main subroutine of your generated code if the control needs to call a Registration function. The code in the section must be valid PB code.
ie.
code:
<<<INITCODE>>>
REGISTERMYCLASS "MYCLASS32"
<<<END>>>