UBBFriend: Email This Page to Someone!
  Computer Workshop User Forums
  EZGUI Dialog Designers Tutorials
  Creating EZC files for custom controls

Post New Topic  Post A Reply
profile | register | preferences | faq | search

next newest topic | next oldest topic
Author Topic:   Creating EZC files for custom controls
Chris Boss
Administrator
posted 02-19-2008 01:29 PM     Click Here to See the Profile for Chris Boss     Edit/Delete Message Reply w/Quote
Here I will discuss how to create EZC files for custom controls !

EZC files are just text files with the specifications for the control to use.

You can use NotePad to create them, but save the file with the file extension of .ezc

Here is an example:

code:



<<<DESC>>>
Custom Control #2
<<<END>>>
<<<CLASS>>>
MY_CUSTOM_CTRL2
<<<END>>>
<<<DLL>>>
cusctrl2.dll
<<<END>>>
<<<INCLUDES>>>
#INCLUDE "cusctrl2.INC"
<<<END>>>
' syntax: FunctionName|par1
' par1 must be a string in quotes or a numeric value (long)
<<<REGISTER>>>
<<<END>>>
' 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>>>
<<<USECOLORMSG>>>
YES
<<<END>>>
<<<USEFONTMSG>>>
NO
<<<END>>
<<<DEFAULTTEXT>>>
Hello
<<<END>>>
<<<NOTIFY>>>
<<<END>>>
<<<INITCODE>>>
<<<END>>>
<<<CODE>>>

<<<END>>>



I'll break down the meaning of each section in the file.

First, notice the sections are blocks which have a macro name (ie. <<<CODE>>> ) to start a block and the <<<END>>> macro to finish the block.

All the text within a section block is significant. Spacing before any text is not significant and is ignored by the designer and removed.

In the <<<INITCODE>>> and <<<CODE>>> sections you can define spacing before code using the {TAB} macro.

ie.

{TAB}CallMySub 1

The {TAB} macro will be expanded to the TAB setting (of spaces) in the project when the code is generated.

Now let's look at some of the sections to see what they are for.


Chris Boss
Administrator
posted 02-19-2008 01:40 PM     Click Here to See the Profile for Chris Boss     Edit/Delete Message Reply w/Quote
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>>>


All times are EST (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic
Post New Topic  Post A Reply
Hop to:

Contact Us | Computer Workshop ( EZGUI ) Home Page

Copyright 2000 to 2007 Christopher R. Boss

Powered by: Ultimate Bulletin Board, Version 5.44
© Infopop Corporation (formerly Madrona Park, Inc.), 1998 - 2000.