Control Cloning Tools
Usually when designing forms (or other designers) there are situations when
you need to implement controls with similar behavior on two or more forms
(for example a Browse... command-button that will open a standard dialog
box to select a file or folder location). You can copy the control (the Browse...
command-button in our example) but copying the code from the event procedure may
be a tedious task, especially if you have implemented other events too.
Generally, such a task involves creating every control on the desired location,
writing the code behind one control and transferring it to the other controls. CodeSMART
features a tool that automates this operation - the Control Cloning Tool.
It will help you easily duplicate a control along with all the code that is has
in its event procedures through two simple copy and paste commands.
To duplicate a control with code:
-
Open the designer window of the component containing the control you
want to clone.
-
Select the control you want to clone. You can select only one control
at a time (multiple selection is not supported).
-
Click Copy Control with Code on the Designer Tools toolbar or
select the same entry from the CodeSMART main menu.
-
Open the designer window of the component you want to place the copied
control on. Make sure that this component is not read-only.
-
Click Paste Control with Code on the Designer Tools toolbar or
select the same entry from the CodeSMART main menu. The control will be pasted
to the specified destination.
If a control with the same name already exists in the destination component
then the new control will be pasted as part of a control array or with
a different name. If you choose to paste the new control with a different
name causes all the code associated with it in the source component to
be duplicated into the destination component and properly transformed to
reflect the new name. If you choose to paste the control as part of a control
array only the code that is not already implemented in the destination
component will be copied.
Note
-
Because these tools use the standard Windows clipboard, if an operation that
affects the clipboard contents is performed requesting a Copy Control with
Code then the Paste Control with Code operation will be invalid.
See Also
Back To Top
|