Commit Graph
38 Commits
Author SHA1 Message Date
dotCooCoo 79ef692ce5 Scripts: palette events keep their checks after getters and print questions
- paletteClose with another engine's palette id no longer drops that
  palette's waiting events.
- A hidden palette is not described after a run or an add, so a
  throwing getter on it no longer fails the run; script.palettes and
  docs/mcp.md say a hidden palette lists its controls as they were.
- A check box's click rechecks the box after reading its value, so a
  getter that disables it or closes the palette stops the click.
- A list's change rechecks that the list is still enabled and visible
  after its item texts are read, and is dropped when a getter disabled
  or hid it.
- A waiting palette event does not start its run, or ask for frames,
  while the last run's print jobs wait for their answer.
- script.palette.event's help states that a change merges only after
  its palette's last waiting click or close.
2026-12-02 17:05:59 -08:00
dotCooCoo 2cf9f56194 Scripts: palette events keep their file access, hide and enabled checks
- update() takes a waiting palette event only when the run's file access
  roots reach the same files as the event's, so a handler never runs with
  less access than its palette was shown with.
- A palette event is no longer delivered to a handler after its palette
  was hidden and shown again, or after a capturing listener disabled or
  hid the control or a group above it.
- A limit that ends a handler update() took restores the run's own
  actions before the end-of-run refresh.
- A palette refresh that fails reports no unhandled rejection.
- A refused palette field text no longer replaces text typed after it.
- The script.run, script.palette.event and docs texts describe update()
  delivery, list staleness after item edits, and repeating a click or
  close dropped with an oversized text.
2026-12-02 10:49:08 -08:00
dotCooCoo cbf870502a Scripts: palette state checks use the no-script property lookup
Main changed `Interp::find_property` to take `&mut self`, since it now
runs the traps of a proxy on the prototype chain. `plain_state` called it
through `&Interp`, so the merge of main did not compile (E0596 at
crates/js/src/scriptui.rs:2010). It now calls `find_ordinary_property`,
which keeps reading `enabled` and `visible` without running any script.
2026-12-02 05:26:28 -08:00
dotCooCoo ddeb70f2c2 Merge main into feat/scripts-scriptui-palettes 2026-12-02 05:12:36 -08:00
dotCooCoo 666f7e3db2 Scripts: a palette click is dropped when a later getter disables its button
A getter read after a button while the palette was described could
disable or hide the button, or a group above it, after the description
recorded it as enabled, and the click still ran its handler.

- Palette states are read without running a getter, once every
  description getter (the default and cancel elements included) has
  run, and a state that a getter gives counts as off. Dialogs keep
  reading the states through their getters.
- Delivering a palette event reads the states of the control and the
  groups above it again the same way, and checks that the palette still
  holds the control, before the handler runs.
- docs/mcp.md, the progress line and script.palette.event's params text
  describe the rule.
2026-12-02 01:54:08 -08:00
dotCooCoo d091abbf53 Scripts: palette handlers that update() runs play their palette's actions
- A handler that a palette's update() runs in a later run of the same
  engine plays the actions of the run that showed the palette, as a
  handler's own run does. After the handler ends, or throws out of
  update(), app.doScript plays the run's own actions again.
- script_palette_start gives the app the error of an open edit that
  cannot be settled, and the waiting events keep waiting; it no longer
  returns None, which showed nothing.
- A palette event runs no handler or listener once a getter or an
  earlier listener took its control out of the palette, and a click or
  change is dropped when a getter read for the event disabled or hid
  the control or a container above it.
- A palette list's change ends its run with an error when an item's
  text comes from a getter, an inherited property or an object.
- The run's report of unhandled rejections is made again after the
  palettes are refreshed, leaving out a rejection that a getter gave a
  handler, and stays empty after a failed run.
- A text a palette's field gave stays in the field until no change of
  that field waits, also while a run before the change set the field to
  the same text.
- The report test replaces a waiting change ahead of another field's
  change, and the modal-wait test requires that no later frame is asked
  for.
- docs/mcp.md: a list's change made before the app puts it in line is
  dropped without an error; an error a handler throws out of update()
  can be caught, and the run then keeps the handler's changes.
2026-12-01 21:45:22 -08:00
dotCooCoo 682f27810a Merge main into feat/scripts-scriptui-palettes 2026-12-01 14:04:42 -08:00
dotCooCoo d74312bedc Merge main into feat/js-object-set-prototype-of 2026-11-30 20:44:43 -08:00
dotCooCoo 1d6af09cff Scripts: a stop from end when show() fails ends the run
When show() failed (an answer that could not be read, a host call that
threw, or a handler that threw), the dialog's failure function called the
host's end and dropped its result, so an Abort from end did not stop the
run and the script could catch the error and finish. The failure function
now returns that stop, and the answer and call paths end the run with it
before the error reaches the script.
2026-11-30 17:59:40 -08:00
dotCooCoo 77cc99b2bd Scripts: palette refreshes run their getters' promise jobs, and events keep their place
- A prompt, confirm or alert answer that cannot reach the script is listed
  in the report with the answer "error" instead of the answer given.
- After a named-engine run, point changes that a palette getter makes
  while the palettes are refreshed are written before the run ends.
- The promise jobs a palette getter queues during that refresh run in the
  same fuel, the host gets the controls once more after them, and their
  unhandled rejections are part of the run's report. An update() they
  call takes no waiting event.
- A waiting text change merges with a newer one only when no click or
  close of its palette waits after it.
- With nobody to ask, an open edit that cannot be finished before the run
  ends script.palette.event with that error, and the event does not wait.
- A click whose onClick getter hid the palette runs no handler, and a list
  choice whose list a text getter removed, or whose earlier item text a
  later getter changed, is refused.
- add() and remove() on a shown palette return their result when a getter
  throws while the host's copy is updated; the host gets the controls at
  the next update or when the run ends.
- In the app, a palette event whose run cannot begin shows its own error
  instead of an earlier stopped run's message.
- The overview comments, docs/mcp.md and the progress line describe the
  update() handling, the merge rule, onClose returning false and the
  named engine a palette needs.
2026-11-30 15:05:36 -08:00
dotCooCoo 7b3690163e Scripts: palette events report their own run, and dialogs keep typed texts on a failed handoff
- script.palette.event with nobody to ask answers with the report of the
  run that handled the given event, also when it took the place of an
  earlier waiting event or a run of its engine took it with update(); an
  event dropped without a run is an error, and a later event that cannot
  start leaves the given event's result. An open drag in a document other
  than the active one is refused before the event waits, and the app's
  palette start check uses the same rule.
- A palette event's handler and the refresh after a run take no waiting
  event through update(), so a later event does not run inside them. The
  refresh after a named run spends at most the unbroken-run allowance.
- A click whose button a getter removed during the event runs no handler.
- A window answer that could not reach the script lists the dialog with
  the answer "error" instead of "stop".
- In a ScriptUI dialog, Escape, ui.dialog.cancel and a click keep the typed
  texts when the run does not take the event, and a refused event asks for
  the next frame so the queued events after it go on.
- Quitting while only palettes are open asks whether to stop the run.
2026-11-30 03:31:54 -08:00
dotCooCoo 91f413e9bb Scripts: palette events keep the file scope they were given in
Queued palette events keep the file access scope of the pass that gave
them, and update() runs only the events whose scope the running script
already has. update() on a removed container throws an error the script
can catch. The palette dialog returns its events from the Dialog body,
and the palette and script window tests run their frames through
testing::part_frame.
2026-11-29 15:56:12 -08:00
dotCooCoo 2666d07712 Scripts: a list made with items counts each one in its revision
Main's new_items builds a list's items in one step without counting them
in the list's revision, so a palette event for a list made with two items
carried a revision the list no longer had and was refused. Count each item
as add does. Also apply rustfmt to two lines from the merge.
2026-11-28 19:51:43 -08:00
dotCooCoo b0e8c2055f Merge main into feat/js-es2015-proxy-reflect-m
Proxies join main's construct path in class_ops.rs: new and Reflect.construct both run the construct trap there, with new.target passed through. A Symbol-key lookup passes through a proxy to its target, so spread and for-of read a proxy of an array with the array iterator.
2026-11-28 18:47:57 -08:00
dotCooCoo f48c493551 Merge main into feat/scripts-scriptui-palettes 2026-11-28 18:24:09 -08:00
dotCooCoo 1d3e835927 Scripts: ScriptUI review fixes for heap-limit adds and removes, listeners, list texts, Enter, the run's questions and automation requests
- Adding a control or an item, and removing items, builds both arrays
  before the first write, so a run that ends at the heap limit leaves the
  lists and the dialog's counts as they were.
- A listener registered after an event started does not hear it in a later
  phase, a capturing container's re-registration included.
- show() reads the dialog again when a getter changes a list item's text
  after the item was read.
- Enter and Escape skip an OK or Cancel button inside a hidden or disabled
  container.
- A resource string of a name and a type without braces throws a
  SyntaxError, and a \u escape pair of surrogates reads as one character.
- In the app, queued events wait while another dialog is open over the
  script's dialog, and the run's own questions wait while a popup, such as
  an open drop-down list, is over it. ui.dialog.confirm and
  ui.dialog.cancel take only the dialog, ui.dialog.set needs a field or an
  action and answers with the dialog it set, and OK is refused while a
  dialog open over it waits. A cancel after typed text clicks the cancel
  button the dialog has when its turn comes, and an immediate cancel the
  run refuses is an error.
- A click on a list box row gives the list the keyboard focus.
- The vc hint test names BridgeTalk, since Window now exists; the params
  text and docs/mcp.md say that a show() in a handler notify runs throws
  only in the app, and define_script_ui says when end is not called.
2026-11-28 02:43:06 -08:00
dotCooCoo f6aef4fc8a Scripts: a queued list choice is dropped when a handler replaced the item, and the new items stay kept while counted
A list counts how many times a script replaced its items, so a choice queued
against an item a handler removed and added again with the same text is not
replayed against the new item. The items array stays kept from collection
while the count's slot reserves room.
2026-11-26 00:18:53 -08:00
dotCooCoo 5654c06c6d Scripts: ScriptUI review fixes for resource strings, list choices, listeners and the dialog's cancel and close
A resource string's characters size edit fields and static text, a list's items must be an array, a listener added again runs in a later dispatch only, a close asked for while the dialog is described closes it, a list selection a getter changes is read again, and Escape during a handler cancels the dialog the run waits at next. The thrown error of a failed host call stays kept while the failure callback runs.
2026-11-26 00:18:53 -08:00
dotCooCoo 48357310ad Merge feat/scripts-scriptui-dialogs into feat/scripts-scriptui-resources 2026-11-25 20:43:55 -08:00
dotCooCoo 541c361e8c Scripts: ScriptUI dialogs draw with craft containers, and remove() changes nothing when it fails
- The dialog's body only reports its events, typed texts and whether a
  field has the focus; the dialog applies the last run's report after the
  container, and Enter outside a field comes from take_submit after it.
- The controls scroll in a craft Stack, and a panel is a GroupBox.
- remove() on a container walks the removed control's subtree and checks
  the heap before its first change, so a run that ends in it leaves the
  container, the dialog's counts and the control as they were.
- The dialog's accessibility tests draw through part_frame.
2026-11-25 19:31:31 -08:00
dotCooCoo 5473a2217b Scripts: a ScriptUI dialog's OK and Cancel found by name or text skip buttons that cannot be clicked
Without defaultElement or cancelElement, the dialog's default and cancel
buttons are the first enabled and visible buttons named or titled OK and
Cancel, so Enter and Escape click a button the dialog takes a click on.
2026-11-25 15:44:37 -08:00
dotCooCoo 9dc197b4e4 Scripts: ScriptUI dialogs refuse look-alike containers, noecho fields and stale descriptions
- An answer step with an empty control matches only an unnamed control whose
  text is empty, not the first unnamed control.
- add() and add("item") on an object made to look like a container or list
  throw a TypeError and charge nothing to the dialog's limits.
- A new list's initial items are read through ordinary property access, so an
  index getter gives its value.
- findElement() keeps the controls it has still to look at rooted while a
  name getter runs, and skips a control the element no longer holds.
- A close() that onClose calls before it returns false belongs to the close it
  refuses; the dialog waits for the next event.
- show() throws for an edittext with noecho before the dialog opens.
- show() reads the dialog again when a getter adds or removes a control after
  the controls were read, and throws when it changes again.
- An edit field takes at most 32,768 characters while it is typed.
2026-11-25 14:41:28 -08:00
dotCooCoo 7737e97068 Scripts: a closed palette's visible is false
`close()` and the close box set the palette's `visible` to false once `onClose` lets it close, as
`hide()` does, so a script that checks `visible` stops updating a closed palette.
2026-11-25 12:36:05 -08:00
dotCooCoo ed0c7432ce Scripts: no palette listener runs once an earlier one closed the palette
A palette event checks before each listener that the palette still takes it, so a listener that
closes the palette stops the listeners after it, on the control and on its containers.
2026-11-25 12:26:11 -08:00
dotCooCoo 08638f5859 Merge feat/scripts-scriptui-dialogs into feat/scripts-scriptui-palettes 2026-11-25 11:30:03 -08:00
dotCooCoo 037a01b521 Scripts: update() checks each waiting palette event against the palette as handlers left it
update() takes the events that wait for the run's palettes one at a time.
Before each one, the host now gets every palette's controls as the script
and the earlier handlers left them, as at the end of a run, so a click on
a control that an earlier handler disabled, hid or removed runs no handler
and is dropped. The new host function palettePending says whether an
event still waits.

An update() that a getter or a handler calls while events are being taken
takes none itself; the update() already taking them goes on with the next
one, instead of calling itself until a limit stops the run.

Docs: docs/mcp.md palette bullet.
2026-11-24 22:49:29 -08:00
dotCooCoo aa8c9b8d36 Scripts: ScriptUI builds windows and controls from resource strings
new Window() and add() threw that resource specifications were not
available yet. They now read a resource specification in place of the
type, as
https://extendscript.docsforadobe.dev/user-interface-tools/resource-specifications/
describes it: a type, then braces holding `name: value` properties,
where `name: Class { ... }` defines a control.

- `crates/js/src/scriptui_resource.rs` reads `[name:] Type { ... }`.
  A value is null, true, false, a quoted string, a number, an inline
  array or an inline object. The commas between properties may be left
  out, as in the page's own example. A malformed specification throws a
  SyntaxError. One longer than 1 MiB or nested more than 64 deep throws
  a RangeError; these limits are VectorCraft's own.
- With a resource specification, new Window() and add() read no other
  argument. `properties` gives the creation properties. Each control in
  the braces is added through add(), with its limits of 512 controls
  nested 16 deep, and set as the container's property of its name. A
  list's `items` gives its item texts, as add()'s third argument does.
  Each other value is assigned to the property of its name. Palettes and
  windows still throw that they are not available yet.
- The script.run params text, docs/mcp.md and the Scripts line in
  docs/target-app-parity.md describe resource specifications.
2026-11-24 17:29:22 -08:00
dotCooCoo 73394611d1 Scripts: ScriptUI windows, groups and panels have update()
Window.update() was missing, so a palette handler that moved a progress
bar and called update() ended with an error. The window-object reference
describes update() as redrawing the window and taking the person's
waiting events, so that a Cancel button can stop a long loop
(https://extendscript.docsforadobe.dev/user-interface-tools/window-object/).

- update() on a shown palette, or on a group or panel in it, runs the
  handlers of the clicks, changes and closes that wait for the palettes
  of the run's engine, oldest first, so a loop that calls update() sees
  a Cancel button's onClick. Those events do not get runs of their own.
- In the app, an update() in the script's own code then pauses the run
  so the app draws the palette, at most once every 16 ms of the run's
  time (VectorCraft's own interval). Only an update() that pauses gives
  the host the palette's controls, so a loop of many update() calls does
  not use up the run's host-call or bridge limits. An update() in a
  handler, a callback of a built-in function, a getter or a conversion,
  and any update() on the web, does not pause the run.
- update() on the showing dialog, or a group or panel in it, runs
  without an error; the dialog shows a handler's changes when the
  handler returns. On a window that is not showing it throws an Error,
  and on a control that is not a container a TypeError. Whether a
  palette is showing comes from show() and hide(), not from its visible
  property.
- docs/mcp.md and the progress-doc line describe update().
2026-11-24 11:46:45 -08:00
dotCooCoo 8cc34c71a0 Scripts: a palette event is dropped once a getter or a handler closed the palette
A palette event checks again, after the palette's description is read and
after each handler is read or run, that the host still shows the palette
under the id the event names. A getter or an earlier handler that closed
the palette now stops the event, so no click or change reaches a closed
palette, and a list change whose palette closed is dropped rather than
refused.
2026-11-24 09:17:14 -08:00
dotCooCoo e5d3c9a7fc Scripts: a dialog listener's close(result) decides show() for the default button
- When a click on the default or cancel button has no handler of the button's
  own, a listener on a container that calls close(result) now decides what
  show() returns; before, the button's result 1 or 2 replaced it.
- An event on objects made to look like controls whose parents form a cycle
  ends with a TypeError once the chain is longer than a dialog's nesting
  allows, instead of walking the cycle until the run's fuel is gone.
- The Run Script params text says that an unknown event type throws, and the
  progress line says that only the dialog takes a show listener.
2026-11-23 13:26:13 -08:00
dotCooCoo 66f081428a Scripts: queued ScriptUI events follow their control by id after a handler removes one
- Each ScriptUI element gets an id that the dialog's description carries. The
  app keeps a queued click or change, and each typed text, with its control's
  id instead of the control's position in its container, so a handler that
  removes a control no longer sends a later click or typed text to the control
  that moved into its place. An event whose control was removed is dropped,
  and so is a queued list change when a handler changed the list's items.
- A container that no longer holds the control when its turn comes does not
  get the event, and a listener that an earlier one removed in the same event
  does not run. The containers above the target stay kept from collection
  while the listeners run.
- A removed control and the controls it holds have no `window`; `removeAll`
  throws on them like `add` and `remove`.
- Every element starts with its listener list, which a script cannot replace,
  and `remove` and `removeAll` refuse an object made to look like an element
  of a real dialog.
- docs/mcp.md says a group takes its properties fourth when the third argument
  is not an object, as the code does.
2026-11-23 13:08:15 -08:00
dotCooCoo 3089ed73a5 Scripts: ScriptUI listeners are limited and removed controls leave their dialog
- A control with alignment fill stays within its maximumSize when its
  container's room is larger.
- A window or control takes at most 256 event listeners (VectorCraft's
  own limit); one more throws a RangeError. A show listener can be
  added only to the dialog, and on a control it throws an Error.
- A capturing listener on a container that stops a click keeps the
  default or cancel button from closing the dialog. Listeners on the
  containers that do not capture still leave the button to close it.
- stopPropagation() acts only on an event whose listeners are running,
  and preventDefault() does nothing, since the events are not
  cancelable.
- A control removed from its container has no parent, its events no
  longer reach the containers it was in, and add and remove on it, or
  on a control it holds, throw an Error. Its controls are no longer
  counted toward the dialog's limits.
- remove(text) throws an Error, and removes nothing, when a text getter
  changes the list or container while it looks for a match.
- A group takes its creation properties fourth again when the third
  argument is not an object, as in add("group", undefined, undefined,
  {name: "g"}).
- A click on a radio button now turns off only the radio buttons of its
  set, the ones added next to it with no other kind of control between
  them. It used to turn off every radio button in its container.

Docs: docs/mcp.md now says that notify runs the handlers without closing
the dialog.
2026-11-23 12:25:38 -08:00
dotCooCoo 29153af625 Scripts: ScriptUI controls take size objects, event listeners, list find and remove, and Window.alert
- Every element starts with preferredSize, size, minimumSize and
  maximumSize objects whose width and height are -1, so a script can
  set one side, as in preferredSize.width = 100. A positive side of
  size takes the place of preferredSize's, and the layout keeps a
  control within its minimum and maximum.
- Controls and the dialog take addEventListener and
  removeEventListener for click, change, changing and show. Handlers
  run in the capture phase on the containers, on the control after its
  onClick, onChange or onChanging, then on the containers again until
  one calls stopPropagation(). A button with a click listener no longer
  closes the dialog by itself.
- Window.alert, Window.confirm and Window.prompt open the same dialogs
  as alert, confirm and prompt.
- A list has find(text) and remove(what), and takes its items in
  properties.items; a container has remove(what).
- A group takes its creation properties as the third argument of add(),
  and orientation, alignChildren, spacing, margins and alignment given
  there are its first values.
- Setting a radio button's value to true turns off the radio buttons
  added next to it in its container, and notify("onClick") turns a
  radio button on and a check box over before onClick runs.

Docs: docs/mcp.md, docs/target-app-parity.md.
2026-11-23 11:35:40 -08:00
dotCooCoo f05ec9a090 Scripts: a palette event finds its control by its place, and a run at its dialog idles
- script.palette.event's params text lists `control` and `value` with
  their notes in parentheses, so the description reads as a params
  object again.
- A palette handler's run gets the place of the clicked or changed
  control from the host and gives the event to the control at that place
  in the palette as it is then. A getter read while the palette is
  described can add a control before it; the event no longer goes to the
  control that took its index. An event whose place holds no control is
  an error.
- While a run waits at its ScriptUI dialog, the app asks for no frames;
  the pass that gives the dialog's event asks for the next one, and so
  does a frame that handles a control request while a run goes on, such
  as `ui.dialog.confirm` answering the dialog.
2026-11-22 21:36:00 -08:00
dotCooCoo ab15fbb0d1 Scripts: palette events keep their errors, and palettes keep visible in step
- script.palette.event takes a whole float such as 1.0 as a list's item
  index, as a window answer does.
- With nobody to ask, an event given while an undo group is open is
  refused with the undo-group error and is not kept. An event whose run
  cannot begin, for example because a recovery copy cannot be saved,
  ends the call with its error, and the events after it keep waiting.
- A handler's error keeps its file, line and column when a palette
  getter also throws in the refresh after the run.
- A palette's controls reach the host once, after the handler's run
  ends, so a getter is read once for a run that completes.
- The refresh roots its copy of the palette list while getters run.
- hide() sets a palette's visible to false, and show() sets it to true
  once the host shows it.
- A close() inside a modal dialog's onClose does nothing, as for a
  palette; a later close runs onClose again.
- A palette list change reads the list's revision after its item texts,
  whose getters may replace the items.
- Bounds given as x, y, width and height keep their right and bottom
  edges finite.
- A palette event that waits for an open undo group asks for no frames;
  the frame that ends the group asks for the next one.
- A list choice queued in a ScriptUI dialog carries the list's items and
  revision, and is not given when a handler changed the list since. The
  status message has a row in every complete catalog.
- docs/mcp.md: with nobody to ask, the undo-group refusal and the event
  whose run cannot begin; a handler reads the files allowed with Always.
2026-11-22 17:32:54 -08:00
dotCooCoo 26e0cef48d Scripts: ScriptUI palettes stay open after the run and run their handlers in line
new Window("palette") in a script with a named #targetengine shows a
palette that stays open beside the documents after the run ends.
show() runs onShow and returns at once; hide(), show() and close()
work as for a dialog, and close() and the close box run onClose.

Each click, change or close on a palette runs its handler as a run of
its own in the palette's engine, with its own report and undo step.
While another run goes on, the event waits and runs after it, oldest
first; a newer event for the same control or close replaces a waiting
one. An error in a handler ends that run and leaves the palette open.
A palette in a script without #targetengine, or with #targetengine
main, throws an Error that asks for a #targetengine line.

Palettes close when their engine is dropped or ends with an internal
error, and when the session ends. A session keeps at most 16 palettes
and 64 waiting events.

script.palettes lists the palettes and their controls, and
script.palette.event gives a palette a click, change or close. The
script checker lists palettes under dialogs instead of hostOnly.
2026-11-22 11:19:11 -08:00
dotCooCoo 3745b14db4 Scripts: ScriptUI dialogs keep to their limits and steps under reentrant handlers
- A show() that a handler's error ended with steps left in `answers` now
  ends the run and rolls it back, even when the script catches the error.
- A list step's value written as a whole float (1.0) is an item index,
  in `answers` and in ui.dialog.confirm; a fraction is still refused.
- A progress bar's fraction stays finite across the widest range.
- add() checks the control and item counts again after the getters and
  conversions it runs, refuses an initial item array longer than the
  items left before reading it, and counts a new list's items only once
  the list is added.
- show() keeps the values a getter gives while their properties are
  read, and reads the dialog again when a getter changes a list after
  it was read; a list that changes again throws an Error.
- A click or close from ui.dialog.confirm gives the text still typed in
  the dialog's fields first.
- Quitting while a handler runs keeps the dialog and its queued events,
  so Cancel shows it again with them.
- Screen readers call an edit field without a name by the visible static
  text just before it in its container.
- The dialog's heading follows a title a handler changed while the
  dialog is open.
- A list box gives screen readers a list box node named by its name or
  the static text before it, with the selected item as its value, and a
  drop-down list is named the same way.
- The dialog closes when show() returns, also when the script goes on
  running.
- Enter clicks the default button while the keyboard focus is on a
  control other than an edit field, such as a slider.
2026-11-22 04:00:21 -08:00
dotCooCoo c3ea4e2f9c Scripts: build and show ScriptUI dialogs with new Window("dialog")
A script can now build a modal dialog with new Window("dialog", title)
and add() groups, panels, static text, edit fields, buttons, check
boxes, radio buttons, drop-down lists, list boxes, sliders and progress
bars. The engine checks the description and lays it out without
recursion, within VectorCraft's own limits (512 controls 16 deep, 1024
list items, 16 KiB a text, sizes clamped to 8192 px). Other control
types, palettes and resource strings throw that they are not available
yet.

- show() waits like alert, runs onClick, onChanging, onChange, onShow
  and onClose in the run's fuel, and returns close(result)'s result, 1
  for the default button or 2 for the cancel button, or 0 for the close
  box. A show() inside a handler throws.
- In the app the dialog draws the controls where the engine placed
  them, gives text still typed in a field before a click or a close,
  and keeps its state while a handler runs. Enter clicks the default
  button, Escape the cancel button, and Stop ends the run and puts the
  documents back.
- A run over MCP or the command line takes a window answer: the steps
  of one show(), each a click, a change or a close.
- The report lists each dialog with its controls, events and result;
  vc.api.has("scriptui") is true.

Docs: docs/mcp.md (script.run), docs/target-app-parity.md.
2026-11-22 00:14:17 -08:00