🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
Clipbook
This page was created by Hans.karlsen on 2024-10-01. Last edited by Wikiadmin on 2026-07-29.

You can copy text to the user's clipboard from a ViewModel by assigning it to the reserved string variable vClipbookData.

Copy data from a ViewModel

Clipbook is MDriven's name for the user's clipboard. Define a string variable named exactly vClipbookData in the ViewModel when an action or expression needs to place text on the user's clipboard.

The name is case-sensitive:

vClipbookData:string

When vClipbookData changes to a non-empty string at runtime, Turnkey copies its value to the user's clipboard and displays the notification Copied. After the copy, Turnkey clears vClipbookData.

Steps

  1. Open the relevant ViewModel in MDriven Designer.
  2. Add a variable named vClipbookData with the type string.
  3. In the action or logic that should copy data, assign the text to vClipbookData.
  4. Run the ViewModel in Turnkey.
  5. Trigger the action. When the variable receives a non-empty value, Turnkey copies that value and shows Copied.

Example

If an action assigns the following value:

Customer: Ada Lovelace

Turnkey copies Customer: Ada Lovelace to the clipboard. The user can then paste it into another application.

Important behavior

Behavior What it means
Reserved variable name Use vClipbookData with exactly this spelling and casing. A differently named variable does not trigger clipboard copying.
Copy trigger A copy is triggered when the variable is different from an empty string.
After copying Turnkey empties vClipbookData. Do not rely on the variable retaining the copied value after the notification appears.
Copied content The value is copied as text. Format the string before assigning it when the receiving application requires a particular layout.

Copy selected table cells

Turnkey also supports copying selected cells from tables. In the Blazor and Angular renderings, a user can select cells in a table, press Ctrl+C, and paste the result into Excel or another application. The copied table values are tab-separated, which allows spreadsheet applications to place values in separate cells.

For example, a user can select a rectangular range of values in a seeker or another Turnkey table, press Ctrl+C, and then paste the values into Excel. Cell selection is available for tables in general, not only seekers. Take care when selecting in an editable table: dragging may start text selection within an editable value rather than select the intended cells.

Use cell selection when the user needs to copy displayed table data. Use vClipbookData when your ViewModel logic needs to copy a specific text value.

Related clipboard uses

MDriven Designer can use clipboard JSON or XML when adding classes, attributes, and associations from clipboard data. This is a Designer modeling workflow and is separate from assigning vClipbookData in a running Turnkey ViewModel.

See also