diff --git a/Button/button_def.mch b/Button/button_def.mch index f8d3665717d60f847e645223bb34ab284fb0e3d5..1f348a173125b81ce384d2a677c4491ee8223be2 100644 --- a/Button/button_def.mch +++ b/Button/button_def.mch @@ -1,30 +1,19 @@ MACHINE button_def -// An example that uses the new feature to use VisB DEFINITIONS +// An example that uses VisB DEFINITIONS instead of a JSON and SVG file DEFINITIONS - "LibraryStrings.def"; - VISB_JSON_FILE == ""; - VISB_SVG_BOX == rec(height:200, width:240); - VISB_SVG_OBJECTS == rec(svg_class:"circle", `id`:"button", - cx:"100",cy:"100", r:"80", - stroke:"black", `stroke-width`:"3"); - VISB_SVG_UPDATES == rec(`id`:"button", - fill: IF button=TRUE THEN "green" ELSE "red" END); - VISB_SVG_HOVERS == rec(`id`:"button", stroke:"gray", - `stroke-width`:"5") -VARIABLES - button -INVARIANT - button:BOOL -INITIALISATION - button := FALSE + VISB_JSON_FILE == ""; + VISB_SVG_BOX == rec(height:200, width:240); + VISB_SVG_OBJECTS == rec(`id`:"button", svg_class:"circle", + cx:"100",cy:"100", r:"80", stroke:"black", `stroke-width`:"3"); + VISB_SVG_UPDATES == rec(`id`:"button", + fill: IF button=TRUE THEN "green" ELSE "red" END); + VISB_SVG_HOVERS == rec(`id`:"button", + stroke:"gray", `stroke-width`:"5") +VARIABLES button +INVARIANT button:BOOL +INITIALISATION button := FALSE OPERATIONS - press_button = PRE button=FALSE THEN - button:=TRUE - END; toggle_button = BEGIN button:= bool(button=FALSE) - END; - set_button(newVal) = PRE newVal:BOOL THEN - button := bool(newVal=TRUE) END END \ No newline at end of file