TMultiContainer
A responsive multi-region container component with header, footer, left/right slide panels, and central content area. Fully responsive with automatic mobile adaptation.
Overview
TMultiContainer provides a complete page layout solution with five distinct regions: Header, Footer, Left Panel, Right Panel, and Central Content. It automatically adapts to different screen sizes and can merge footer actions into a mobile menu.
Unit & Inheritance
UNIT Obj.Container.Multi;
TMultiContainer = CLASS(TCoreDiv)
// Inherits from TCoreDiv for CSS class support and ElementHandle access
Design-Time Behaviour
At design time, all five sub-components are created as real components with color-coding for easy identification:
- Header - Cream/Beige (#FFEDCB)
- Footer - Light Green (#90EE90)
- Left Panel - Light Pink (#FFB6C1)
- Right Panel - Peach (#FFDAB9)
- Central Content - Lavender (#E6E6FA)
These colors are removed at runtime, leaving transparent backgrounds that inherit from parent styling or themes.
Published Properties
| Property | Type | Default | Description |
|---|---|---|---|
| HeaderContent | TSubSlideContainer |
Auto-created | The header region. Supports slide-down animation. |
| FooterContent | TSubCoreDiv |
Auto-created | The footer region. Fixed to bottom of container. |
| LeftContent | TSubSlideContainer |
Auto-created | Left slide panel. Slides in from left edge. |
| RightContent | TSubSlideContainer |
Auto-created | Right slide panel. Slides in from right edge. |
| CentralContent | TSubCoreDiv |
Auto-created | Main content area. Fills remaining space. |
| HeaderHeight | Integer |
50 | Height of the header region in pixels. |
| FooterHeight | Integer |
60 | Height of the footer region in pixels. |
| LeftPanelWidth | Integer |
280 | Width of the left slide panel when open. |
| RightPanelWidth | Integer |
280 | Width of the right slide panel when open. |
| MainMenu | TWebMainMenu |
nil | Reference to main menu for mobile menu merging. |
| HideFooterOnMobile | Boolean |
True | When True, footer is hidden on mobile and actions merge to MainMenu. |
| Debug | Boolean |
False | When True, shows design-time colors at runtime for debugging. |
Public Properties
| Property | Type | Description |
|---|---|---|
| CurrentMode | TDeviceMode |
Current device mode: dmDesktop, dmTablet, or dmMobile. |
| Dom | TDom |
Internal TDom instance for viewport tracking and CSS manipulation. |
Public Methods
Slide Panel Control
Opens the right slide panel with animation.
Closes the right slide panel with animation.
Toggles the right panel open/closed. Returns True if panel is now open.
Opens the left slide panel with animation.
Closes the left slide panel with animation.
Toggles the left panel open/closed. Returns True if panel is now open.
Opens/shows the header with slide-down animation.
Closes/hides the header with slide-up animation.
Toggles the header visibility.
Footer Visibility
Hides the footer and expands the central content to fill the space. Updates the central content's bottom offset to 0.
Shows the footer and adjusts the central content accordingly. Restores the central content's bottom offset to accommodate the footer height.
Mobile Menu Merging
Adds an item to be merged into the MainMenu when in mobile mode. The Key is used to identify items for removal.
Removes a previously added merge menu item by its key.
Removes all merge menu items.
Responsive Behaviour
TMultiContainer uses TDom for viewport tracking and automatically adapts its layout:
Desktop/Tablet Mode
- Header visible at top
- Footer visible at bottom
- Central content fills middle area
- Left/Right panels slide on demand (hidden by default)
Mobile Mode
- Header visible at top
- Footer hidden (if HideFooterOnMobile = True)
- Footer actions merged into MainMenu as burger menu items
- Central content expands to fill available space
- Left/Right panels slide over content when opened
Usage Examples
Basic Setup
// Drop TMultiContainer on form - sub-components are auto-created
// Access regions directly:
MultiContainer1.HeaderContent // Header region
MultiContainer1.FooterContent // Footer region
MultiContainer1.CentralContent // Main content area
MultiContainer1.LeftContent // Left slide panel
MultiContainer1.RightContent // Right slide panel
Opening Side Panels
PROCEDURE TMainForm.btnMenuClick(Sender: TObject);
BEGIN
MultiContainer1.ToggleLeftContainer;
END;
PROCEDURE TMainForm.btnSettingsClick(Sender: TObject);
BEGIN
MultiContainer1.OpenRightContainer;
END;
Mobile Menu Integration
PROCEDURE TMainForm.FormCreate(Sender: TObject);
BEGIN
// Link to main menu for mobile merging
MultiContainer1.MainMenu := WebMainMenu1;
// Add footer actions that will appear in mobile menu
MultiContainer1.AddMergeMenuItem('home', 'Home', @HomeClick);
MultiContainer1.AddMergeMenuItem('settings', 'Settings', @SettingsClick);
MultiContainer1.AddMergeMenuItem('profile', 'Profile', @ProfileClick);
END;
Programmatic Footer Control
PROCEDURE TMainForm.EnterFullscreen;
BEGIN
MultiContainer1.HideFooter;
MultiContainer1.CloseHeaderContainer;
END;
PROCEDURE TMainForm.ExitFullscreen;
BEGIN
MultiContainer1.ShowFooter;
MultiContainer1.OpenHeaderContainer;
END;
CSS Classes
TMultiContainer applies the CSS class dashboard-multi-container to itself. Sub-components can be styled via their ElementClassName property or by targeting their auto-generated names.
Sub-Component Types
The sub-components use special "Sub" variants that hide published properties in the Object Inspector to reduce clutter:
TSubCoreDiv- For Footer and Central (no published properties)TSubSlideContainer- For Header, Left, Right panels (slide properties set internally)
See Also
- TSlideContainer - Slide panel component used by Left/Right/Header
- TCoreDiv - Base component class
- TDom - DOM access and viewport tracking
- TCoreGridPanel - Grid layout for content areas