Repository navigation
Commit 2da92c2
feat(pages): author all three of a widget's icon elements (#1059)
`Icon: image <qn>` and `Icon: glyph <n>` on page widgets, completing the round
trip the previous commit could only make honest.
actionbutton btnEdit (Caption: 'Edit', Icon: 'Atlas_Core.Atlas_Filled.pencil')
actionbutton btnLogo (Caption: 'Logo', Icon: image MyModule.Images.logo)
actionbutton btnHome (Caption: 'Home', Icon: glyph 57377)
The bare form stays the icon-collection icon, so no existing script changes
meaning; a name may also be written unquoted, as every other reference into the
model is. The keyword is the whole point: the first two forms are spelled
identically and point into DIFFERENT documents, so nothing else separates them.
Same vocabulary as navigation's `icon image` / `icon glyph`, and the same ANTLR
ordering trap (qualifiedName accepts a keyword as a name segment, so the
keyword-led alternatives must come first).
One vocabulary, not a third. `pages.Icon` carried its own three-value enum for
the same three Mendix elements, which is exactly the drift that produced the
bug; it now uses types.MenuIconKind, and both writers dispatch on it instead of
inferring from a payload that cannot distinguish the two named kinds.
The legacy engine wrote `Icon: nil` on every action button unconditionally. A
button icon has been authorable since #602 and only the modelsdk engine ever
wrote one, so under `--engine legacy` it was dropped on every write — silently,
because a null Icon is what an iconless button stores. Both engines now write
all three.
Validation caught up with the kinds:
- `check --references` resolves each kind against its OWN collection. Before, an
image reference was checked against the icon collections and reported as a
typo — the same conflation, pointed the other way. When the kind is wrong the
message names the remedy instead of leaving a correct name looking misspelt.
- MDL078 (undefined glyph code) now covers widget glyphs. It walked the
statements itself and knew only about menus, so every widget glyph would have
passed in silence. Both it and the reference check now consume the package's
single icon walk.
Measured on 11.13.0 against a real project: all three authored, `mx check` 0
errors, `mxbuild --target=deploy` BUILD SUCCEEDED, and the three elements on
disk with the right $Type and payload. The controls pin it — the same page with
`image` dropped gives exactly `[CE1613] "The selected custom icon
'MyFirstModule.Images.workflow' no longer exists." at Action button 'btnImage'`,
and a widget `Icon: glyph 57562` fails the deploy build with
`System.InvalidOperationException: Sequence contains no matching element`,
naming the PAGE — so MDL078's message no longer promises "layout". Corpus sweep
clean at 531 scripts.
Not covered: NavigationList item and DropDownButton icons are still not read at
all, so they are dropped as silently as a widget glyph used to be.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017s476QkXr9CFMvKspVzcvu1 parent 2f330b5 commit 2da92c2
26 files changed
Lines changed: 1478 additions & 237 deletions
File tree
- .claude/skills
- fix-issue/findings
- mendix/create-page
- cmd/mxcli/syntax
- docs/01-project
- mdl-examples/bug-tests
- mdl
- ast
- backend/modelsdk
- executor
- grammar/domains
- visitor
- sdk
- mpr
- pages
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
611 | 611 | | |
612 | 612 | | |
613 | 613 | | |
| 614 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
380 | 380 | | |
381 | 381 | | |
382 | 382 | | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
383 | 418 | | |
384 | 419 | | |
385 | 420 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
15 | 31 | | |
16 | 32 | | |
17 | 33 | | |
| |||
0 commit comments