Card
File: Rhapsodist/Core/Widgets/Card.js · Namespace: Card.
Overview
A Card is Rhapsodist’s main UI building block for grouping controls: a styled panel with an optional title.
Usage
Panels on the UI with names pnlCard\d are automatically discovered and converted into styled cards.
Cards are also created manually by calling create().
If a card contains two or more child panels with non-empty text, it becomes a tabbed card, using SwitcherPanel: the text values become clickable tab labels, and clicking a tab switches which child panel is visible.
const pnlMyCard = Card.create("pnlMyCard", {});
Options
| Option | Description | Default |
|---|---|---|
tabWidth | Width of each tab label, in pixels, on a tabbed card. createCardsFromPanels() passes {tabWidth: 95} for every auto-discovered card. | Panel’s width divided by the number of tabs. |
Look and Feel
| Function | Draws |
|---|---|
drawCard | The card’s whole paint routine, replacing the default drawing entirely. |
drawCardBackground | An extra pass drawn on top of the card’s default background fill; it doesn’t replace that fill. |
drawCardBorder | Just the border. |
drawCardLabel | Just a tab label, on a tabbed card. |
Public API
| Function | Description | Returns |
|---|---|---|
create(panelId: string, options: JSON) | The main entry point. | ScriptObject |
createGrid(parentPanel: ScriptObject, gutter: number, layout: Array, options: JSON) | Lays out many same-shaped cards at once from a layout array of {column, row, columnSpan, rowSpan} specs and a target numColumns/numRows grid. | — |
Internal Reference
| Function | Description | Returns |
|---|---|---|
createCardsFromPanels() | Called automatically at load. Auto-discovers every panel whose ID matches pnlCard\d and turns it into a card, this is how an expansion’s pnlCard0/pnlCard1/etc. panels become Cards without an explicit Card.create call. | — |
paintRoutine() | The default paint routine for a card, used when LookAndFeel.drawCard isn’t defined. Draws the background, border, and tab labels. | — |
mouseCallback() | Handles hover and click events on a tabbed card’s labels, tracking the hovered tab and calling setValue/changed on the panel when a tab is clicked. | — |