← Back to Policy Tracker guide
ViewItem — "Copy Title" button next to Newsletter Title
A small button that copies whatever's currently in txtTitle1 (the main Title field) into txtNewsletterTitle1 (Title for Newsletter), one click.
conNewsletterCard1 (the card holding this field) is a Vertical AutoLayout container — its children get positioned by stacking order, not by X/Y. That means the button can't just be dropped next to the field with coordinates the way it could in a ManualLayout card. It needs its own small horizontal row wrapping both controls together.Step 1 — new variable
In ViewItem's OnVisible, add this line near the other Set() calls at the top:
Set(varNewsletterTitleOverride, "");
Step 2 — wrap the field in a horizontal row
In the Tree view, find txtNewsletterTitle1 inside conNewsletterCard1. Insert a new Horizontal container in that same spot, name it conNewsletterTitleRow1, then drag txtNewsletterTitle1 to become its first child.
| Control | Properties |
|---|---|
conNewsletterTitleRow1 | Width=Parent.Width - 36 (takes over the card's existing right-margin convention — every other field in this card already uses that same -36)Set Gap to 8 via the properties pane (not a formula — same insert-time-only property as other Horizontal containers this session) |
Step 3 — shrink the field, it's now in a narrower row
| Control | Property | Change |
|---|---|---|
txtNewsletterTitle1 | Width | Was Parent.Width - 36 (when Parent meant the card) — now that its parent is conNewsletterTitleRow1, change to Parent.Width - 40 (leaves room for the button) |
Step 4 — the copy button, second child of the same row
| Property | Value |
|---|---|
Width | 32 |
Height | 36 (match txtNewsletterTitle1's actual rendered height if it looks different live) |
Fill | RGBA(255, 255, 255, 1) |
Color | RGBA(91, 105, 97, 1) |
BorderColor | RGBA(214, 221, 224, 1) |
BorderThickness | 1 |
HoverFill | RGBA(227, 239, 232, 1) |
Text | ⋮⋮ or just "Copy" — whatever reads clearly at 32px wide, your call |
Tooltip | "Copy Title into Newsletter Title" |
// btnCopyTitleToNewsletter1.OnSelect Set(varNewsletterTitleOverride, txtTitle1.Text); Reset(txtNewsletterTitle1); Set(varNewsletterTitleOverride, ""); Set(varUnsavedChanges, true)
Step 5 — the one formula that actually makes the copy stick
Replace txtNewsletterTitle1.Default so it checks the override variable first, falling back to the real saved value exactly like before:
// txtNewsletterTitle1.Default — full replacement Coalesce(varNewsletterTitleOverride, varSelectedRelease.'Title for Newsletter', "")
Why this shape:
Default only gets read once, at the moment the control is created or Reset() is called on it — it isn't reactive on its own. The button sets the override, calls Reset() to force Default to re-read (picking up the override), then immediately clears the override back to "" so it doesn't linger and overwrite your typing the next time this screen's own OnVisible resets the field for a different item. Coalesce treats "" as blank and skips straight to the real saved value once the override's been cleared.