Table of Contents

TAdvCustomFormDesigner Class

Component used to allow runtime form design.

Remarks

TAdvCustomFormDesigner is the base class for TAdvFormDesigner component, used to allow designing of forms at runtime. The component must always be owned by the form that must be edited. You can turn designing on and off using the Active property. This component provides several properties and events for customizing the way the form is being edited. Several methods are provided to persist form changes, like saving and loading the form to streams and files. In Scripter Studio Pro IDE, this component is used internally by the inplace form designer.

Syntax

Unit: FormDesigner

TAdvCustomFormDesigner = class(TComponent);

Methods

Name Description
AddComponent Adds a non-visual component to the current selection in the form designer.
AddControl Adds a control to the current selection in the form designer.
AlignControls Aligns currently selected controls according to specified alignment rules.
AlignControlsToGrid Aligns the selected controls to the designer grid.
AlignDialog Shows the align controls dialog, which allows end-user to align controls verticaly/​horizontally.​
AlignToGrid Aligns a control to the form designer grid.
AutoPlaceComponent Finishes a component placing operation and inserts the control centered in currently selected control.
BringControlsToFront Brings the selected controls to front of other existing controls in the form.
CancelPlacing Cancels a component placing operation.
CanCopy Returns true if a copy (or cut) to clipboard operation can be performed by the designer.
CanPaste Returns true if a paste from clipboard operation can be performed by the designer.
ClearControls Deprecated, same as UnselectAll.
ClearForm Deletes all components in the form.
ControlAtPos Returns the control found at an specified position in the form.
ControlIndex Returns the index of the control in the current selection list.
CopyToClipboard Copies the currently selected components to the clipboard.
CreateComponentClass Creates a new component instance of the specified component class, owned by the current form being edited.
CreateComponent​Class​Name Creates a new component instance of the specified component class, owned by the current form being edited.
CreateObjects Create objects instantiate some internal objects needed by the form designer, like the hint window and grab glyphs.
You will rarely need to call this method.
CutToClipboard Cuts the currently selected components to the clipboard.
DeleteComponent Removes a non-visual component from the current selection in the form designer.
DeleteControl Removes a control from the current selection in the form designer.
DestroyObjects Destroyes objects created by CreateObjects method.
DoAddControl DoAddControl is called when a new control is added to the current selection in the form designer.
In other words, it is called when a control is selected.
DoBeforePlace​Component This method is called just before a new component is placed and selected in the form designer. When DoBeforePlace​Component is called, the component being placed is not yet selected.
DoChange DoChange method is called when the form content has changed (a control was moved, resized, deleted, etc.).
It's usually called by NotifyChange
DoControlDblClick This method is called when a control is double clicked in the form designer.
DoDeleteControl DoDeleteControl is called when a control is removed from the current selection in the form designer.
In other words, it is called when a control is unselected.
DoMoveSizeControl This method is called when a moving or sizing operation is performed in the designer. This method fires the OnMoveSizeControl event for each selected control.
DoPlaceComponent DoPlaceComponent is called right after a new component is placed and selected in the form designer.
DoSelectControl Deprecated. Most appropriated method is DoAddControl.
DoSelectionChange DoSelectionChange method is called when the current selection in form designer changes.
DrawGrab Draws a grab handle.
FindComponent​Container Finds the component container control for a non-visual component in the form.
FindNextControl Use FindNextControl to retrieves the next control to be selected given the current selection.
FindWinControl Finds a control in the form given its window handle.
GetComponentCaption Retrieves the caption for the specified component, used to show caption for non-visual components.
GetComponentHint Retrieves the hint for the specified component, used to show a hint when the component is being moved/resized.
GetComponent​Properties Saves the current component into a string value.
GetEditBehaviour GetEditBehaviour retrieves the edit behavior for a control being edited in the form.
GetIDEComponent​Editor Retrieves the TIDEComponentEditor object (if any) registered for a component being edited.
HideAlignmentPalette Hides the alignment palette window.
IsLocked Call IsLocked to determine if the control specified by AControl is locked or not. A locked control cannot be moved or resized.
IsProtected Call IsProtected to determine if the control specified by AControl is protected or not.
A protected control cannot be selected.
IsTransparent Call IsTransparent to determine if the control specified by AControl is transparent or not.
A transparent control is totally ignored by the designer, cannot be selected, edited or deleted, its behavior is exactly as if it was part of the form's background.
LeaveMouseAction Cancels the current mouse operation.
LoadComponent​From​Stream Loads a specific component from a stream.
LoadFromDFM Loads the form from a file.
LoadFromFile Deprecated method. Use LoadFromDfm or LoadFromStream instead.
LoadFromStream Loads the form from a stream.
Lock Locks the designer preventing controls to be edited. If you call Lock twice, you must call Unlock twice to effectively unlock the designer.
NotifyChange NotifyChange method is called when the form content has changed (a control was moved, resized, deleted, etc.).
The AOperationName indicate the operation performed in the designer (move, paste, etc.)
OptionsDialog Shows the designer options dialog, which allows end-user to set general options, like snap grip, for example.
PasteFromClipboard Pastes components from the clibpoard and automatically selects the pasted components.
PlaceComponentClass Starts a component placing operation in the designer.
PlaceComponent​Class​Name Starts a component placing operation in the designer.
RemoveSelected​Controls Removes the currently selected components from the form, destroying the component instances.
SaveComponent​ToStream Saves a specific component to a stream.
SaveToDFM Saves the form to a file.
SaveToFile Deprecated method. Use SaveToDfm or SaveToStream instead.
SaveToStream Saves the form to a stream.
SelectAll Selects all controls in the form designer.
SendControlsToBack Sends the selected controls to back of other existing controls in the form.
SetComponent​Properties Loads a component from a string value. The component state is retrieved from a string previously saved with GetComponent​Properties.​
ShowAlignmentPalette Shows the alignment palette window, which provides buttons to align controls horizontally/​vertically.
SizeControls Resizes currently selected controls according to the specified resize rules.
SizeDialog Shows the size controls dialog, which allows end-user to resize width and height of controls.
SynchroLock Prevents further changes to the designer to fire change notification events, like OnChange and OnSelectionChange.
Using SynchroLock allows you to perform changes in the designer without receiving notifications that the designer has changed, or selection has changed. Use SynchroUnlock to retrieve the designer to normal state.
SynchroUnlock Unlocks the designer previously locked with SynchroLock. You need to call SynchroUnlock as many times as you have previously called SynchroLock method in order to effectively unlock the designer.
TabOrderDialog Shows the tab order dialog, which allows end-user to set tab order of controls.
Unlock Unlocks the designer previously locked with Lock method. You need to call Unlock as many times as you have previously called Lock method in order to effectively unlock the designer.
UnselectAll Unselectes all controls in the designer, automatically selecting the parent form itself.
Update Update method refreshes the form designer, updating its visual elements like the grab handles and non-visual component icon and caption.
UpdateGrabs Refreshes the grab handles according to latest changes, like grab size, glyph, etc..
UpdateGrid Updates (refreshes) the snap grid.

Properties

Name Description
Active Indicates if the form designer is active (on) or inactive (off).
AlignmentColorBottom Specifies the color of bottom alignment line. The line will be displayed in move or resize operations if it is enabled in AlignmentLines property.
AlignmentColorLeft Specifies the color of left alignment line. The line will be displayed in move or resize operations if it is enabled in AlignmentLines property.
AlignmentColorRight Specifies the color of right alignment line. The line will be displayed in move or resize operations if it is enabled in AlignmentLines property.
AlignmentColorTop Specifies the color of top alignment line. The line will be displayed in move or resize operations if it is enabled in AlignmentLines property.
AlignmentEntireForm When AlignmentLines are used, this property specifies if the alignment lines will be shown in the entire form, or only in the parent control.
AlignmentLines Specifies which alignment lines will be visible in a move or resize operation.
AlignmentPalette Specifies some options for the alignment palette form.
AlignmentPaletteForm Provides a direct reference to the alignment palette form.
Ancestor When saving a form to stream or file, you can specify an ancestor component so that the designer will only save what is different from the ancestor, instead of saving all components and properties of the form.
AvoidFormMoving When true, prevents the parent form to be moved by the end-user using the keyboard.
ClearBeforeLoad Indicates if all existing controls must be deleted before a load operation is performed.
Component Contains the currently selected component in the designer.
Components[Index] Provides indexed access to the currently selected components in the designer. The total of selected components is provided by ControlCount method.
Control Contains the currently selected control in the designer.
ControlCount Provides the number of selected components in the designer.
Controls[Index] Provides indexed access to the currently selected controls in the designer. The total of selected controls is provided by ControlCount method. For non-visual components, the control is the TComponentContainer control that represents the component.
DesignControl Indicates a specific control to be designed, instead of a form. This property is here for backward compatibility and show not be used by now.
DesignerColor Indicates the background color of the form being designed. If DesignerColor is clNone, the current color of the form will be used.
DisplayGrid Use DisplayGrid to show or hide the designer snap grid.
EnableAxisDrag When EnableAxisDrag is true, end-user can limit moving a control by its horizontal or vertical axis only, by pressing the Ctrl key while moving the control with the mouse.
FormData Contains a string representation of the current form.
GrabMode Specifies where the grab handles are located relative to the control bounds.
GrabSize Specifies the size of the grab handles in the designer.
GrabsTransparent​Color Defines the transparent color to be used for the custom grab handle glyphs, when UseGrabGlyphs property is true.
GridColor Specifies the color of the dots in the designer grid.
GridStep Contains the separation between grid dots. In other words, the grid size. The grid is displayed when DisplayGrid property is true.
KeyMove When KeyMove property is true, the selected controls can be moved and resized using keyboard.
Behavior is similar to Delphi IDE: Shift+Arrows resize the block, Ctrl+Shift+Arrows move the block according to grid size, and Ctrl+Arrows might move the block pixel by pixel or by grid size, depending on value of SnapToGridKey property.
KeySelect When KeySelect property is true, the controls can be selected in the designer using keyboard keys like arrow and tab keys.
LockChildren Indicates how children controls will be treated when a control is locked in the designer.
Locked Indicates if the designer is in a locked state due to one or more calls to Lock method. In a locked state, the controls can't be moved or resized.
LockedControls Contains the name of components that should be locked in the designer.
LockedGrabBorder Specifies the color of the grab handle border when the selected component is locked.
LockedGrabFill Specifies the fill color of the grab handle when the selected component is locked.
LockedGrabGlyph Use LockedGrabGlyph to provide a custom bitmap to be displayed in place of the grab handle, when the selected component is locked.
The image will only be displayed if UseGrabGlyphs property is true.
LockedInverse If true, the components in LockedControls list will be considered as not locked, and all others will be locked in the designer.
MenuControl Indicates the control for which a context popup menu should be displayed.
MessageProcessor Indicates how the application messages are handled by the form designer.
Modified Indicates if the form was modified (a control was moved, for example). This property is automatically set to true by the designer when something changes in the designer. You can manually set this property back to false (or true) if you need to.
MouseAction Indicates the current mouse action (mouse state) of the designer.
MoveLimitMode Specifies what are the limit boundaries for the mouse cursor during move operations.
MultiGrabBorder Specifies the color of the grab handle border when multiple components are selected in the designer.
MultiGrabFill Specifies the fill color of the grab handle when multiple components are selected in the designer.
MultiGrabGlyph Use MultiGrabGlyph to provide a custom bitmap to be displayed in place of the grab handle, when multiple controls are selected in designer.
The image will only be displayed if UseGrabGlyphs property is true.
MultiSelect When MultiSelect is true, the designer allows more than one component to be selected at the same time.
NormalGrabBorder Specifies the color of the grab handle border when it is in normal state.
NormalGrabFill Specifies the fill color of the grab handle when it is in normal state.
NormalGrabGlyph Use NormalGrabGlyph to provide a custom bitmap to be displayed in place of the grab handle, when it is in normal state.
The image will only be displayed if UseGrabGlyphs property is true.
ParentForm Indicates the form that is being edited / will be edited by the designer.
PlacedComponentClass During a component place operation, contains the class of the component that will be created when the placing operation is finished.
PopupMenu Contains the popup menu to be displayed when end-user performs a right click in the designer.
ProtectChildren Indicates how children controls will be treated when a control is protected in the designer.
ProtectedControls Contains the name of components that should be protected in the designer.
ProtectedInverse If true, the components in ProtectedControls list will be considered as not protected, and all others will be protected in the designer.
ProtectMode Indicates the protection mode for components marked as protected in the designer.
ShowComponent​Captions If ShowComponent​Captions is true, a caption is displayed below the non-visual components, showing the name and class of the component. You can change the caption value using OnComponentCaption event.
ShowComponentHint When true, a hint is displayed when the mouse moves over a component in the designer.
ShowMoveSizeHint When true, the designer shows a hint while moving or resizing operations.
ShowNonVisual If ShowNonVisual property is true, the non-visual components are displayed in the designer and can be selected and moved.
Default value is true.
SnapToGrid When true, all controls are snapped to grid in insert, moving and resizing operations, regardless of the value of DisplayGrid property.
SnapToGridKey Indicates how the designer will treat Ctrl+Arrows key operations. If false, then Ctrl+Arrow will move the controls pixel by pixel. If true, Ctrl+Arrow will move the control by the value specified in GridStep property.
SynchroLocked Indicates if the designer is in a synchro locked state due to one or more cals to SynchroLock method. In a synchro locked state, change notification events are not fired, like OnChange or OnSelectionChange.
TransparentChildren Indicates how children controls will be treated when a control is transparent in the designer.
TransparentControls Contains the name of components that should be transparent in the designer.
TransparentInverse If true, the components in TransparentControls list will be considered as not transparent, and all others will be transparent in the designer.
UpdatingSelection If greater than zero, indicates that the changes in the current selection are being performed by internal operations of the form designer, not by the end-user.
UseGrabGlyphs When true, the grab handles will not be drawn directly by the designer, but instead, a bitmap will be displayed at the grab handle position. The bitmap to be displayed must be defined in properties NormalGrabGlyph, MultiGrabGlyph or LockedGrabGlyph, depending on the grab handle state.

Events

Name Description
OnActivate OnActivate event is fired when the form designer is activated, and the form enters into design/edit mode.
OnAddControl OnAddControl event is fired when a control is added to the current selection. In other words, the event is fired when a control is selected in the form designer.
OnChange OnChange event is fired whenever a change is performed in the form designer.
OnComponentBitmap Use OnComponentBitmap to provide a custom icon for the non-visual component specified in the event.
If this event is not assigned, then the designer tries to retrieve the component bitmap from a bitmap resource which name is the same as the component's class name.
OnComponentCaption Use OnComponentCaption event to provide a custom caption for the component provided by the event.
By default, the component caption is the name of the component or the class name (in case component doesn't have a name).
OnComponentEditable OnComponentEditable event is fired for every non-visual component in the form to allow the programmer to inform if the specified component is editable (visible) or not. By default all components are editable, except some special classes like TMenuItem and the TAdvCustomForm​Designer itself (which is owned by form).
OnComponentHint Use OnComponentHint event to provide a text hint for the component provided by the event.
By defaul the component hint shows its name and class name.
OnContextPopup This event is fired when a mouse right click is performed in the designer, and allows the programmer to do a different operation than just showing the default popup menu.
OnControlDblClick OnControlDblClick is fired when a control is double clicked in the form designer. The control which was double clicked is provided by the event.
OnCopyComponent This event is fired whenever a component is copied (or cut) to clipboard.
OnCreateComponent​Class This event is fired when a component class is needed and has to be created. If the event does not return a result the component is created internally.
OnCustomizeGrabs OnCustomizeGrabs event is fired by the form designer to allow programmer to specify which grab handles will be visible and/or enabled in the form designer.
OnDeactivate OnDeactivate event is fired when the form designer is deactivated, and the form exits the design/edit mode, entering into the normal runtime mode.
OnDeleteControl OnDeleteControl event is fired when a control is removed from the current selection. In other words, the event is fired when a control is unselected in the form designer.
OnEditBehaviour OnEditBehaviour is fired by the designer to retrieve the edit behavior for the specified component.
OnEndPlacing OnEndPlacing is fired when a place operation is about to be finished, but before the component is effectively placed in the form. This is an opportunity to change the position where the component will be placed.
The event handler receives a rect with the position where the component will be placed, and can change that value.
OnEndSelecting OnEndSelecting is fired when a selection operation using a selection drag rect is about to be performed.
All the controls in the selection rect will be selected, and this is an opportunity to change the value of the selection rect before the selection happens.
OnKeyDown OnKeyDown is fired when a key is pressed during form editing.
OnKeyUp OnKeyUp is fired when a key is released during form editing.
OnLoadControl Deprecated
OnMessage OnMessage is a custom opportunity to handle window messages hooked by the form designer. You will rarely need to use this event.
OnMoveLimit OnMoveLimit event is fired by the form designer when a component is being moved, to allow the programmer to provide the limit boundaries for the control.
OnMoveSizeControl OnMoveSizeControl event is fired right after a control is moved or resized in the form designer.
OnPasteComponent This event is fired whenever a component is pasted from clipboard.
OnPlaceComponent OnPlaceComponent is fired right after a new component is placed (inserted) in the form.
OnReadError OnReadError event is fired when an error occurs while trying to load the form from a stream or file.
OnSaveControl Deprecated
OnSelectControl Deprecated
OnSelectionChange OnSelectionChange is fired whenever the current selection changes in the form designer, i.e., when a component is selected or unselected.
OnShowAlignment​Palette This event is fired when the alignment palette form is displayed. The palette form is provided to the event handler.
OnSizeLimit OnSizeLimit event is fired by the form designer when a component is being resized, to allow the programmer to provide the size limits for the control.