Object Inspector
The Object Inspector is a properties and events editor similar to Delphi and C++Builder. It allows you to visually configure control properties and assign event handlers without writing code manually.
Overview
The Object Inspector has two main tabs:
- Properties — Edit control properties in a categorized grid
- Events — Assign event handlers to control events
At the top, a Control Selector ComboBox lets you switch between all controls on the current form.
Select any control in the Form Designer to see its properties in the Object Inspector. Changes you make are instantly reflected in the designer and code.
Properties Tab
Categorized Grid
Properties are organized into categories for easier navigation:
| Category | Properties |
|---|---|
| Appearance | cPrompt, cValue, nWidth, nHeight, nClrPane, nClrText, oFont, cPicture |
| Position | nLeft, nTop, nWidth, nHeight |
| Behavior | lVisible, lEnabled, lTabStop, lReadOnly |
| Data | cDataSource, cDataField, nDataType |
| Font | cFontName, nFontSize, lFontBold, lFontItalic |
Property Editors
Different property types use different editors:
| Property Type | Editor | Example |
|---|---|---|
| String | Text input | Control name, caption text |
| Number | Numeric input | Position, size values |
| Logical | Dropdown (.T./.F.) | Visible, Enabled |
| Color | Color picker | Background, text color |
| Font | Font picker | Font name, size, style |
| Enum | Dropdown list | BorderStyle, Position, WindowState |
Dropdown Editors for Enumerations
Properties with predefined values show dropdown lists:
| Property | Values |
|---|---|
nBorderStyle | 0=bsSizeable, 1=bsSingle, 2=bsNone, 3=bsToolWindow |
nPosition | 0=poDesigned, 1=poCenter, 2=poCenterScreen |
nWindowState | 0=wsNormal, 1=wsMinimized, 2=wsMaximized |
nFormStyle | 0=fsNormal, 1=fsStayOnTop |
nCursor | 0=crDefault, 1=crArrow, 2=crIBeam, 3=crHand, etc. |
Events Tab
The Events tab shows all available events for the selected control type. The event list is dynamic
and retrieved via UI_GETALLEVENTS from the backend.
Assigning Event Handlers
- Double-click an event to auto-generate a handler
- Type directly in the event field to assign a code block
- Select from existing methods via dropdown
// Double-clicking OnClick generates: oBtn:OnClick := { || Button1Click() } METHOD Button1Click() CLASS TForm1 MsgInfo( "Button clicked!" ) return nil
Common Events
| Event | Fires When | Available For |
|---|---|---|
OnClick | User clicks the control | Button, CheckBox, RadioButton, ListBox, etc. |
OnChange | Control value changes | Edit, Memo, ComboBox, CheckBox, etc. |
OnInit | Control is created and initialized | All controls |
OnClose | Form is about to close | Form only |
OnTimer | Timer interval elapsed | Timer only |
OnKeyDown | Key is pressed down | All input controls |
OnKeyUp | Key is released | All input controls |
OnKeyPress | Character key pressed | All input controls |
OnMouseDown | Mouse button pressed | All controls |
OnMouseUp | Mouse button released | All controls |
OnMouseMove | Mouse moves over control | All controls |
OnMouseWheel | Mouse wheel scrolled | All controls |
OnDblClick | User double-clicks | All controls |
OnCreate | Form is being created | Form only |
OnDestroy | Form is being destroyed | Form only |
OnShow | Form is shown | Form only |
OnHide | Form is hidden | Form only |
OnActivate | Form receives focus | Form only |
OnResize | Form is resized | Form only |
OnPaint | Form needs repainting | Form only |
Property Types (C++ Backend)
In the C++ backend, properties are defined with types:
| Constant | Value | Usage |
|---|---|---|
PT_STRING | 1 | Text properties (name, caption, value) |
PT_NUMBER | 2 | Numeric properties (position, size, intervals) |
PT_LOGICAL | 3 | Boolean properties (visible, enabled, checked) |
PT_COLOR | 4 | Color properties (background, text color) |
PT_FONT | 5 | Font properties (name, size, style) |
Code Examples
Setting Properties via Object Inspector
When you edit properties in the inspector, the generated code looks like:
METHOD CreateForm() CLASS TForm1 ::cTitle := "My Application" ::nLeft := 100 ::nTop := 170 ::nWidth := 640 ::nHeight := 480 ::nPosition := 2 // poCenterScreen ::nWindowState := 0 // wsNormal return nil
Event Assignment in Code
// Inline code block oBtn:OnClick := { || MsgInfo( "Hello!" ) } // Call to method oBtn:OnClick := { || ::HandleButtonClick() } METHOD HandleButtonClick() CLASS TForm1 MsgInfo( "Button was clicked" ) return nil
Tips for Using Object Inspector
- Use categories — Expand categories to find properties quickly
- Double-click events — Auto-generates handler methods in your class
- Use dropdowns for enums — Ensures valid values (BorderStyle, Position, etc.)
- Color picker — Click color properties to open the color selector
- Control selector — Use the ComboBox at top to switch between controls
- Real-time updates — Changes reflect instantly in designer and code
- Reset to default — Right-click a property to reset to default value