Component Editor Previous Top Next

Select Tools|Component Editor to show this window.  
 
In the upper half of the Component Editor window, the toolbar is located, allowing to execute the following commands: generation, deletion, export of the component code into an *.mbc file (Map Basic Component) and its import from the file.  
 
new_c This button calls the new component creating dialog. The name of the new component, the parent component and the Component Palette page, where the component should be located, must be set in this dialog.  
 
imp_c This button imports the component, selected from the list, into an *.mbc file (MapBasic Component).  
 
exp_p this button exports the component from an *.mbc file (MapBasic Component), adds it to the list of the registered components and to the Components Palette.  
 
del_c This button deletes the selected component from the list of the registered components.  
 
save_c This button saves changes in the list of the registered components and immediately in the source code of the components themselves.  
 
Further on the toolbar, the list of MBBuilder registered components is located. When choosing the components from the list, the code, realizing the component in question, is imaged in the matching code editors, located on four pages.  
 
·Page Description: Here the verbal description of the component is entered.  
·Page Global Variables: Here the variables, necessary for component functioning, are declared. To provide the name uniqueness for these variables you should add the prefix %COMP_NAME%, e.g. %COMP_NAME%_TableName As String. If you add the component to the dialog, the prefix %COMP_NAME% will be replaced with component name, e.g. TableListBox1_TableName.  
·Page Startup Code. Here the code is written, which will initiate the component at every call of the component containing dialog. This code is added to the _OnShow dialog handler automatically when adding a component to the dialog, and is deleted at the deletion the component from the handler.  
·Page %COMP_NAME%_OnClick Event Handling Code: here the code is written, which will be executed in component handler. This code is added to the _OnClick component handler automatically when adding a component to the dialog, and is deleted at the deletion the component from the handler.  
 
With the help of this tool you can easily create your own components, adapted to your tasks. Most likely you will not be lonely in this field, and that is so much the better: you can exchange the components with other programmers.  
 
Example of creating a new component  
 
Proceed as follows:  
 
1) Call the Component Editor window by selecting Component Editor from the MBBilder Tools main menu .  
2) Click the button new_c on the toolbar of this window.  
3) In the dialog Create New Component:  
 
·in the editing field New Component Name - type CurDateLabel;  
·in the combined choice list Generate Component From set the value StaticText;  
·in the combined choice list Component Palette Page type Test;  
 
4) Click the ÎÊ button.  
5) Select the page Startup Code  
6) Clean the code editor from the text  
7) Type the following string:  
Altert Control %COMP_NAME% Title Str$(CurDate())  
 
Now your first component is ready! It can display the current date. You can put it into the Dialog Editor now.