diff --git a/docs/xml/lcl/extctrls.xml b/docs/xml/lcl/extctrls.xml index 1d89a86d9c..3a22050c93 100644 --- a/docs/xml/lcl/extctrls.xml +++ b/docs/xml/lcl/extctrls.xml @@ -43,7 +43,7 @@
- Register but not displayed + The following are registered but not displayed:
TUNBPages is a TStrings descendant used to represent the names, TPage instances, and the owner class in TNotebook. TUNBPages extends the ancestor class by providing overridden methods needed to add, insert, delete and locate pages with a specified name or TPage class instance.
@@ -515,17 +515,20 @@
- TNotebook is a control which can hold a series of pages placed together. Only one page is shown at a time and this control is completely custom drawn, which means that it is available and looks the same in any widgetset which supports TCustomControl. The pages are containers which can hold controls. This control never has tabs. If you are looking for a control with tabs and pages, please see TPageControl instead.
+ TNotebook is a control which can hold a series of pages order by their position in the list of pages. Only one page is shown at a time.
+
+ This control is entirely custom drawn, which means that it is available - and looks the same - in any widgetset which supports TCustomControl. The pages are containers which can hold other controls. The page control does not display a tab which indicates the active page. If you are looking for a control with tabs representing each of the pages, please see TPageControl instead.
To use a Notebook, select its icon from the 'Additional' tab of the Component Palette and place it on the Form. Adjust its size, position, alignment and anchoring as required, by moving the object on the Form or by using the Object Inspector.
- Pages are added to the NoteBook by selecting the control and right-clicking with the mouse to get a pop-up menu whose first item is 'Add Page'. Pages already in the NoteBook can be edited by selecting the appropriate ActivePage in the Object Inspector and modifying its properties or adding additional components to that Page.
+ Pages are added to the NoteBook by selecting the control and right-clicking with the mouse to get a pop-up menu whose first item is 'Add Page', or by using the Pages property editor in the Object Inspector. Pages already in the NoteBook can be edited by selecting the appropriate ActivePage in the Object Inspector and modifying its properties or adding additional components to the Page.
- Destroy is the overridden destructor for the class instance. Destroy ensures that resources allocated to the internal page list member are freed. Destroy calls the inherited destructor prior to exiting from the method.
+ Destroy is the overridden destructor for the class instance. Destroy ensures that resources allocated to the internal page list are freed. Destroy calls the inherited destructor prior to exiting from the method.
@@ -731,7 +734,13 @@
- Page is an indexed read-only TPage property used to access a page object for the notebook control by its ordinal position in the list of pages.
+ Page is an indexed read-only TPage property used to access a page object for the notebook control by its ordinal position in the list of pages. TPage values in the Page property are maintained when values are added to or removed from Pages.
+
+ Use IndexOf to get the position where a specific TPage instance is stored in the Page and Pages properties.
+
+ Use PageCount to get the number of pages defined in the Pages property. Use ActivePageComponent to get the TPage instance at the position in PageIndex. Use ActivePage to get the name of the page at the position in PageIndex.
- Pages is a TStrings property which contains the page names defined for the notebook control.
+ Pages is a TStrings property which contains the page names and associated TPage instances for the pages defined for the notebook control.
- Setting a new value in Pages causes the new page names to be compared to the internal page objects in the notebook. New or altered pages are added or replaced in the notebook. An existing page object not present in the new page names is deleted; the Application singleton is notified that the page object is being released and allowed to process the message.
+ When the component is created, a TUNPages instance is created and assigned to the property member. It provides overridden methods which maintain the TPage instance associated with a given page name. You can use the Pages property editor in the Object Inspector to maintain the page names and their TPage instances.
- The value in Pages is not assigned at design-time.
+ To add a page to Pages at run-time:
+
+ Use the indexed Page property to access the TPage instance for a given page by its ordinal position. Use PageIndex to set the active page in the notebook control by its ordinal position in Pages. For example:
+
+ Assigning a new TStrings value to Pages causes the new page names to be compared to the existing internal page objects (TPage) in the notebook. New or altered pages are added or replaced in the notebook as needed. An existing page object not present in the new page names is deleted. The Application singleton is notified that the page object is being released and allowed to process the message.
+
+ A new value assigned to Pages is not stored at design-time. Use the Object Inspector to maintain the values in the property.
@@ -1109,11 +1169,11 @@
- TIdleTimer: A timer to measure idle time between processes.
+ TIdleTimer is a timer used to measure idle time between processes.
- CheckNewSize signals the OnCanResize event handler (when assigned) to examine and validate the value in NewSize. The values in NewSize and Result can be updated in the event handler as needed. True indicates that the value in NewSize is acceptable.
+ CheckNewSize signals the OnCanResize event handler (when assigned) to validate the value in NewSize. The values in NewSize and Result can be updated in the event handler as needed. Setting the return value to True indicates that the value in NewSize is acceptable.
CheckNewSize is used in the implementation of the MoveSplitter method.
@@ -1606,13 +1666,14 @@
+ The return value is True by default, but it can be modified in the OnCanOffset event handler.
+
+ Used in the implementation of the MoveSplitter method.
+
+ FindAlignControl is a TControl function used to get the control to which the splitter is aligned.
+
+ Called from the GetResizeControl method which gets the value for the ResizeControl property.
+
+ FindAlignOtherControl is a TControl function used to get the other (secondary) control which is resized when the size for the primary control is changed.
+
+ Called from the GetOtherResizeControl and MoveSplitter methods when the position for the splitter control has been changed.
+
- Overridden in TCustomSplitter. Calls the inherited method, and ensures that the absolute mouse position is used when the left mouse button is depressed; The X and Y arguments are not valid during a resize operation.
+ MouseDown is overridden in TCustomSplitter. It calls the inherited method, and ensures that the absolute mouse position is used when the left mouse button is depressed; The X and Y arguments are not valid during a resize operation.
Calls GetCursorPos to capture the mouse position, and calls StartSplitterMove to initiate the splitter movement operation.
@@ -1802,12 +1895,22 @@
- Updates the value in ResizeAnchor to match the new value for the property. When set to a value other than alClient, the bounds for the control are adjusted to keep the width or height as needed for the new property value.
+ SetAlign is an overridden method in TCustomSplitter which sets the value for the Align property. It ensures that ResizeAnchor is updated to reflect the new value for the property. Values in Anchors are also updated to reflect the new alignment value in the property.
+
+ When Align has a value other than clClient and Anchors is not modified, the bounds for the control are adjusted to keep the existing Width or Height for the Align value.
+ SetResizeAnchor calls UpdateCursor to change the resize cursor to the value needed for the ResizeAnchor enabled for the control. The Align property is changed to alNone to allow the splitter control to be dragged when the MoveSplitter method is called.
+
+ SetResizeControl ensures that the splitter control is repositioned so that it is guaranteed to be closest to the new control in AValue. It updates the Left or Top coordinate in the splitter based on the following values in the Align property:
+
+ No actions are performed in the method if a splitter drag operation has already been started but has not been completed.
+
+ StartSplitterMove ensures that a brush is created to represent the ResizeStyle used for the control. The brush is applied to the rubberband drawn around the splitter control when ResizeStyle contains rsLine or RsPattern.
+
+ StartSplitterMove is called from the MouseDown method when the left mouse button is used to drag the splitter control.
+
+ See StopSplitterMove for the actions performed when the move operation for the splitter control is completed.
+
@@ -1952,7 +2106,7 @@
+ Calls MoveSplitter using the difference between NewPosition and the current splitter position as an argument.
+
+ GetSplitterPosition uses the value in ResizeAnchor to determine the return value for the method. For example:
+
- Align is a TAlign property which specifies how the control is aligned to its parent control. The default value for the property is alLeft in TCustomSplitter.
+ Align is a TAlign property which specifies how the splitter is aligned to the control in ResizeControl. The default value for the property is alLeft in TCustomSplitter, and causes the left edge of the splitter to align to the opposite edge for the ResizeControl.
@@ -3450,7 +3630,7 @@
+procedure TForm1.AddButtonClick(Sender: TObject);
+var
+ NewPageIndex: integer;
+ NewPage: TPage;
+ PageLabel: TLabel;
+begin
+ NewPageIndex := Notebook1.Pages.Add(Format('[Page %d]', [Notebook1.Pages.Count]));
+ NewPage := Notebook1.Page[NewPageIndex];
+ NewPage.Color := RgbToColor(Random(128)+127, Random(128)+127, Random(128)+127);
+ PageLabel := TLabel.Create(Self);
+ with PageLabel do
+ begin
+ Left := 20;
+ Top := 10 + NewPageIndex * 20;
+ Width := 500;
+ Height := 20;
+ Caption := Format('This is page [%d]',[NewPageIndex]);
+ Parent := NewPage;
+ end;
+ Label1.Caption := IntToStr(Notebook1.PageCount)+ ' pages total';
+end;
+
+
+procedure TForm1.PrevButtonClick(Sender: TObject);
+begin
+ if Notebook1.PageIndex > 0 then
+ Notebook1.PageIndex := Notebook1.PageIndex - 1;
+end;
+
+procedure TForm1.NextButtonClick(Sender: TObject);
+begin
+ if Notebook1.PageIndex < Notebook1.PageCount-1 then
+ Notebook1.PageIndex := Notebook1.PageIndex + 1;
+end;
+
+
+
+
+
+
- In the case of TRadioButton, the mutual exclusivity is a feature that applies to any RadioButton anywhere in the Form, and the RadioButtons can be rearranged in any order or placed anywhere within the containing Form, while in TRadioGroup the exclusivity applies only to buttons within the Group, which are ordered strictly according to their ItemIndex within the Items stringlist. + In the case of TRadioButton, the mutual exclusivity is a feature that applies to any RadioButton anywhere in the Form, and the RadioButtons can be rearranged in any order or placed anywhere within the containing Form, while in TRadioGroup the exclusivity applies only to buttons within the Group, which are ordered strictly according to their ItemIndex within the Items for the control.
- TRadioButton is an entity in itself, with a number of additional properties, whereas the buttons within TRadioGroup are not separate entities, but rather are simply entries in a list of strings, each of which is associated with the on-screen image of a RadioButton. + TRadioButton is an entity unto itself with a number of additional properties. In contrast, the buttons within TRadioGroup are not separate entities, but rather are simply entries in a list of strings, each of which is associated with the on-screen image of a RadioButton.
The example shows the difference between the use of TRadioButton and TRadioGroup.
@@ -4594,7 +4774,7 @@
@@ -5132,10 +5312,10 @@
- AdjustClientRect is an overridden procedure used to adjust the drawing rectangle in ARect to account for borders and bevels used on the panel. AdjustClientRect calls the inherited method, and calculates the number of pixels required for the settings in BorderWidth, BeveInner, and BevelOuter. AdjustClientRect calls InflateRect to adjust ARect by the calcluated border and bevel widths.
+ AdjustClientRect is an overridden procedure used to adjust the drawing rectangle in ARect to account for borders and bevels used on the panel. AdjustClientRect calls the inherited method, and calculates the number of pixels required for the settings in BorderWidth, BevelInner, and BevelOuter. AdjustClientRect calls InflateRect to adjust ARect by the calculated border and bevel widths.
AdjustClientRect is called when the control is autosize or aligned.
@@ -5453,7 +5633,7 @@
+ TCustomFlowPanel is a TCustomPanel descendant used to automatically position controls added to the panel in a grid-like layout.
+
+ The FlowStyle property determines layout direction for controls added to the panel.
+
+ FlowLayout controls the vertical positioning for controls in given row on the panel.
+
+ The ControlList property provides a list of wrapper classes maintained for each of the controls on the panel. Its items maintain the position and wrapping options for each control using the FlowStyle and FlowLayout algorithms.
+
+ Adding a control to the panel causes it to be positioned at the next cell in the layout. The Left and Top coordinates for each control are adjusted to position the control within a cell using the FlowStyle and FlowLayout properties for the panel. The Anchors and Align properties for child controls are ignored. The BorderSpacing setting for the controls is used, however.
+
+ AutoWrap indicates whether the controls are automatically flowed into rows based on their settings in ControlList.
+
Calls DisableAlign prior to adding (inserting) the control in ControlList. Calls ReAlign when the control is added, and calls EnableAlign prior to exit.
- AlignControls is an overridden procedure used to perform layout and alignment for flowed controls on the panel. + AlignControls is an overridden procedure used to perform layout and alignment for flowed controls which are a child of the control specified in AControl. RemainingClientRect contains the unused client area where the controls are positioned and aligned. +
++ No actions are performed in the method if child controls do not exist for the panel (ControlCount is 0). +
++ AlignControls ensures space is reserved in the client rectangle for the borders on the panel. The value in FlowStyle determines the position in RemainingClientRect where alignment and layout for the controls is started. Each of the controls in ControlList is visited to adjust the client rectangle for the TControl instances based on the FlowStyle for the panel. SetBounds is called for the TControl instances to reposition / resize the control.
CalculatePreferredSize is an overridden procedure used to calculate the preferred height and width for the flow panel. CalculatePreferredSize calls the inherited method. @@ -6104,13 +6318,19 @@
- The default value for the property is True in TFlowPanel. + The default value for the property is True in TCustomFlowPanel.
- Use TFloatPanel if you need a container with a float layout. The Anchors and Align properties of child controls are ignored. The floating direction is determined with FlowStyle property. + TFlowPanel is a TCustomFlowPanel descendant which implements a panel used to automatically position controls added to the panel in a grid-like layout. +
++ The FlowStyle property determines layout direction for controls added to the panel. +
++ FlowLayout controls the vertical positioning for controls in given row on the panel. +
++ The ControlList property provides a list of wrapper classes maintained for each of the controls on the panel. Its items maintain the position and wrapping options for each control using the FlowStyle and FlowLayout algorithms. +
++ Adding a control to the panel causes it to be positioned at the next cell in the layout. The Left and Top coordinates for each control are adjusted to position the control within a cell using the FlowStyle and FlowLayout properties for the panel. The Anchors and Align properties for child controls are ignored. The BorderSpacing setting for the controls is used, however. +
++ AutoWrap indicates whether the controls are automatically flowed into rows based on their settings in ControlList.
@@ -6751,7 +6989,7 @@
TPopupNotifier
+ TBandPaintOptions is the type passed as an argument in a TBandPaintEvent event handler. Values in the set determine the drawing style used to display a band on a TControlBar instance. +
++ TBandDragEvent is the type used to implement the OnBandDrag property in TCustomControlBar. +
+@@ -7323,37 +7581,54 @@
+ TBandMoveEvent is the type used to implement the OnBandMove property in TCustomControlBar. +
++ Bottom is a read-only Integer property which contains the vertical position that is the bottom of the band control. The value in Bottom is derived using the Top and Height properties, which are updated when a value is assigned to the BandRect property. +
+ The value is updated in the AlignControlToBand method in TCustomControlBar, and provides convenient access to the property value in Control. +
+ AlignControlToBand updates values in ABand to ensure that the Control for the band is centered vertically within its bounds and positioned for the setting in ARightToLeft. Values from the Control are stored in the ControlLeft, ControlTop, ControlHeight, and ControlWidth properties in the control band. This allows the values to be used in subsequent resize operations. +
++ AlignControlToBand is called from the AlignControlsToBands and InitializeBand methods. +
+- Temporarily disables AutoSizing during the alignment process. Restores AutoSizing prior to exiting from the method. + AlignControlsToBands calls the AlignControlToBand method to position and align the visible bands on the control bar. +
++ It temporarily disables auto-sizing during the alignment process. Auto-sizing is restored prior to exit. +
++ AlignControlsToBands is called from the CMBorderChanged, MoveBand, StickControls, and Resize methods. It is also called when a new value is assigned to the RowSize property.
+ CalculatePreferredSize is an overridden method in TCustomControlBar. It re-implements the method from the ancestor class. +
++ CheckBandsSizeAndVisibility is called to initialize the TCtrlBand instances on the control, and to order the bands which have visible controls by their display coordinates. +
++ PreferredWidth and PreferredHeight are variable arguments which contain the preferred dimensions for a new instance of the control. In TCustomControlBar, PreferredWidth is set to 0 to trigger the auto-sizing feature specified in ControlStyle. PreferredHeight is set to the value from the CalcLowestBandBottomPx method, and actually contains the largest value in the Bottom property for the visible controls on the control bands. A positive non-zero value in PreferredHeight also include the space needed inner bevels on the control bands. +
++ CalculatePreferredSize is called when LCL auto-sizing algorithms are executed for the control. +
++ CMBiDiModeChanged calls the inherited method on entry to notify child controls that the value in BidiMode has been changed. Each of the TCtrlBand instances on the control bar are updated so that the Left coordinate for the bands is correct for the Width of the control bar and the new value in BiDiMode. AutoSize is temporarily disabled while the bands are repositioned. +
++ CMBorderChanged calls the inherited method on entry to adjust the client rectangle and control size when a border is added to or removed from the control. +
++ CalcInnerBevelWidth is called to get the space reserved for the settings in BevelInner and BevelOuter. If the calculated value differs from the previous value, the Top coordinate for each of the TCtrlBand instances on the control are shifted to their new positions. AlignControlsToBands is called to align the controls for the bands to their new positions. If IsRightToLeft returns True, the Left coordinate in each of the bands is also shifted. +
++ CreateWnd is an overridden method in TCustomControlBar. It calls the inherited method to update the window control flags and creation parameters when the handle is allocated for the control. +
++ CreateWnd ensures that existing values in the Cursor and Width properties are applied to the internal default values used in the control. +
++ DoBandMove is a method used to signal the OnBandMove event handler (when assigned) using the arguments passed to the method. AControl is the control displayed on the TCtrlBand instance moved in the method. ARect contains the display area for the control derived from the coordinates for the band. +
++ DoBandMove is called from the InitializeBand and MoveBand methods. +
++ DoBandPaint is a method used to draw the specified control for a visible TCtrlBand to the Canvas for the control. It is called from the Paint method for each off the visible bands on the control. +
++ Use the OnBandPaint event handler to perform actions needed to configure the Canvas or render the control instance. +
++ GetControlInfo is called from the InsertControl method when the specified control is positioned, aligned, and added to the internal TCrtlBands container for the control bar. GetControlInfo signals the OnBandInfo event handler (when assigned) to store information about the bounds rectangle, width, and number of rows needed for the control / band. Values are returned in the Insets, PreferredSize, and RowCount variable arguments. +
++ MouseMove is an overridden method in TCustomControlBar which handles a mouse move message at the specified X and Y position using the specified Shift modifier. It calls the inherited method on entry to update the mouse position for the DragManager (when active) and to signal the OnMouseMove event handler (when assigned). +
++ MouseMove calls ChangeCursor to update the cursor shape when a band move operation is started. If the operation is already active and handled by the DragManager, the MoveBand method is called for the band under the mouse pointer. DragControl is called if the DragManager does not handle the action for the specified position. +
++ Determines the new position for a band moved using the mouse or by settings its coordinates. Rearranges adjacent bands (and rows) as needed. +
+- Assigned as the OnChange event handler for the Picture property. + Assigned as the OnChange event handler for the Picture property in the Create constructor.
+ Resize is an overridden method in TCustomControlBar. It calls the inherited method on entry to handle delayed auto-sizing requests and signal the OnResize event handler (when assigned). +
++ When AutoSize is False, the visible TCtrlBand instances on the control are initialized, aligned, and positioned. The controls on the bands are also aligned for each of visible bands. Invalidate is called to force the control to be redrawn. +
+- InsertControl is an overridden procedure used to create, initialize, and store a TCtrlBand for the specified control. InsertControl calls the method inherited from TWinControl, and creates and stores a new TCtrlBand instance for the control in AControl. + InsertControl is an overridden procedure used to create, initialize, and store a TCtrlBand instance for the specified control. InsertControl calls the method inherited from TWinControl, and creates and stores a new TCtrlBand instance for the control in AControl.
+ RemoveControl is an overridden method in TCustomControlBar. It performs additional actions when the Parent for the control in AControl has been set to Nil. +
++ RemoveControl ensures that the TCtrlBand instance for the control is removed from the internal TCtrlBands container. When found, the Delete method in the list is called to remove the band. +
++ RemoveControl calls the inherited method to remove the control specified in AControl. +
++ If the control bar is not being freed, the Invalidate method is called to force the control to be redrawn. +
+Calls the AlignControlsToBands method to align / resize controls on the visible bands for the control bar. @@ -8579,6 +9035,7 @@
- When AutoSize is False, the CheckBandsSizeAndVisibility method is called to Resize the bands in the control bar. When set to False, the inherited method is used. In addition, AutoSize determines if InvalidatePreferredSize is used when setting the value for the RowSize property. + When AutoSize is False, the CheckBandsSizeAndVisibility method is called to Resize the bands on the control bar. When set to False, the inherited method is used. In addition, AutoSize determines if InvalidatePreferredSize is called when setting the value for the RowSize property.
- DrawingStyle is a TBandDrawingStyle property which indicates the fill style applied to the control bar. The default value for the property is dsNormal. Set DrawingStyle to dsGradient to draw the control bar using a gradient defined by the values in GradientDirection, GradientStartColor, and GradientEndColor. + DrawingStyle is a TBandDrawingStyle property which indicates the fill style applied to the control bar. The default value for the property is dsNormal and causes the default background color for the control bar to be used. +
++ Set DrawingStyle to dsGradient to draw the control bar using a gradient fill defined by the values in GradientDirection, GradientStartColor, and GradientEndColor. When clDefault is used in GradientStartColor, it is converted to clForm when the Paint method is called to draw the control. When clDefault is used in GradientEndColor, it is converted to cl3DHighlight in the Paint method.
- Signalled from the DoBandMove method (when assigned) using the TCustomControlBar and TCtrlBand instances as arguments. It occurs when the visibility and size for bands on the control are updated. + Signalled from the DoBandMove method (when assigned) using the TCustomControlBar and TCtrlBand instances as arguments. It is also signalled when the visibility and size for bands on the control are updated in InitializeBand.
- TControlBar implements a panel used to maintain and manage tool bars and toolbuttons on a form. TControlBar is a TCustomControlBar descendant, and sets the visibility for properties from the ancestor class. + TControlBar implements a panel used to maintain and manage tool bars and tool buttons on a form. TControlBar is a TCustomControlBar descendant, and sets the visibility for properties from the ancestor class. +
++ Internally, it uses a TCtrlBands member to represent the TToolBar, TToolButton, or TCoolBar classes added to the container. Use InsertControl and RemoveControl to maintain items in the container at run-time, or use the design-time support provided in the Lazarus Form Designer.
- The default value for the property is bvRaised in TControlBar. + BevelInner is the bevel drawn inside the bounds for the control, and causes the control to have a raised or lowered appearance. The default value for the property is bvRaised in TControlBar. +
++ Use BevelOuter to set the drawing style for the bevel drawn on the bounds for the control. +
++ Use BevelWidth to set the width for the bevels in pixels.
- The default value for the property is bvLowered in TControlBar. + BevelOuter is the bevel drawn on the bounds for the control, and causes it have an over-all raised or lowered appearance when used. The default value for the property is bvLowered in TControlBar. +
++ Use BevelInner to set the bevel drawn inside the bounds for the control. +
++ Use BevelWidth to set the width for the bevels in pixels.
- TTabControl and TPageControl are both descended from TCustomNoteBook (which is in turn descended from TWinControl) and have many inherited properties in common. TPageControl has, in general, more advanced features and is probably intended to replace TNoteBook. + TTabControl and TPageControl are both descended from TCustomNoteBook (which is in turn descended from TWinControl) and have many inherited properties in common. TPageControl has more advanced features and provides a wrapper for the native page control supported for the platform.
-- The following table summarizes the main differences between the two components. -
-- | Property or method | ++ Property or method + | TNoteBook | @@ -9121,10 +9612,10 @@ THeaderControl offers a widget that could be placed along the edge of a Panel or Form, allowing a highly customized mechanism for selection. However, there are no intrinsically associated display areas, and it is the developer's responsibility to supply an index associated with the selection from the THeaderControl and determining what action is to occur or what is to be displayed in any attached Panel or Form.
---|