Reuse a form and make your own components
CrawRAD lets you inherit existing forms to build specialized views, and create custom reusable components that appear directly in the designer palette.
Create a new inherited form
Inherited forms share all components, layout, and event handlers from a base form while storing only your specific additions and property overrides.
- Open the project containing the form you want to inherit.
- Select File > New Inherited Form….
- In the New Inherited Form dialog:
- Use the Filter forms box to find your base form in the tree on the left.
- Inspect the live preview and component summary on the right.
- In the Form name field, type a unique name in
snake_case(for example,customer_dialog).
- Click Create.
CrawRAD creates customer_dialog.crawform and its accompanying code file customer_dialog.rs.
How inherited forms work
- Delta persistence: The inherited
.crawformsaves only changes relative to the base form. If you update the base form later, those updates automatically propagate to all inherited forms. - Inspect base elements: Inherited components appear on the canvas and in the Object Inspector.
- Navigate to base: To open the parent form in the designer, choose Go to base form from the Go menu.
- Event handlers:
- In the Object Inspector > Events tab, select Override inherited event to write a handler in the child form that automatically calls the base handler first.
- To revert an event back to the base form’s implementation, select Revert to inherited.
Create a new component
The New Component wizard scaffolds a self-contained component package with property definitions, ready to drop onto any form.
- Select File > New Component….
- Step 1 of 2 · Base:
- In Name, type a
PascalCasename for your component (for example,PriceEdit). - Under Inherit a component, select the native base class from the drop-down (for example,
SpinEditorEdit). - Under Available in, pick the scope:
- This project: Installed into
<project>/components/<name>and available only in the active project. - All my projects: Installed into the global configuration folder and available in every workspace.
- This project: Installed into
- Click Next.
- In Name, type a
- Step 2 of 2 · Properties:
- Click + Property to add custom properties.
- For each property, specify:
- Name: A
snake_caseidentifier (for example,currency_code). - Type:
String,i64,f64, orbool. - Default: The initial default value (for example,
USDor0.0). - Category: Property inspector category (defaults to
behavior). - Hint: A description displayed in hover tooltips.
- Name: A
- Click Create.
CrawRAD writes the component crate files:
Cargo.toml: Declares dependencies oncrawrad-componentandcrawrad-component-derive.src/lib.rs: Defines your component struct with#[derive(Component)]and#[crawrad(inherits = "...")].manifest.json: Component metadata and property descriptor.
The IDE catalog automatically reloads, and your new component appears under the My components category in the palette.
Install an external component package
To install a third-party component package:
- Select Component > Install Package….
- Select the folder containing the component’s
manifest.json. - CrawRAD checks the manifest. Once accepted, the package is copied into the components directory and registered in the palette.
- To inspect active or refused packages, select Component > Installed Packages….