-
Notifications
You must be signed in to change notification settings - Fork 4
appData
appData is a array which will store data, and is used for testing and debugging while editing the LXB file.
appData can store control sets, property sets and themes. This will allow a single widget to be used for multiple controls and allow for different color schemes. These are activated by the dataCommand property.
Saved controls are a copy of myData. Saved props are the complete values of all the set properties, even those not used by the current controls. Saved themes are the eight main colors saved as RGBA values. It is possible to save a saved set via Livecode script, however they need to be complete. If using Livecode script, the best practice would be to copy and make changes to an existing saved set.
- mAppData["savedcontrols"] - contains sets of controls
- mAppData["savedprops"] - contains sets of properties (including text, but not including colors)
- mAppData["savedthemes"] - contains sets of color themes (STILL UNDER CONSTRUCTION)
When set, the dataCommand property automatically executes commands related to stored sets. The command consists of 3 components separated by colons. The first part is the action being taken: load, save, delete. The second part is what is being acted with: controls, properties, themes (colors). The third part is a name used as a subkey within the mAppData tree. With the exception of name, only the first initial is necessary for the command components. After the load/save/delete is executed, the dataCommand property is set to empty. Here are some examples:
- "save:controls:goofla" - saves the current myData array into mAppData["savedcontrols"]["goofla"]
- "load:prop:hotstuff" - loads the properties stored in mAppData["savedprops"]["hotstuff"]
- "del:theme:lotsofpink" - deletes the subkey mAppData["savedthemes"]["lotsofpink"]
- "s:p:goodprops" is the same as "save:properties:goodprops"
- "l:c:buttons" is the same as "load:controls:buttons"
The increment command can be used to increase or decrease the value of a numeric up/down, slider or progress bar. In this case the "type" is the number of the control and the final is a number that will be added/subtracted from the value.
- "increment:2:13" - increases the value of control #2 by 13
The icon command inserts an SVG path into iconData. The type is the icon family, the name will be the name assigned to the icon. A fourth parameter consisting of the SVG path is also included.
- "icon:buttons:raspberry:"
When making changes to the widget's extension file, appData can be used to save variable information at different stages in order to find problems.
To start a new debugging key use the "clearDebugInfo" command. This will create or empty a key in appData and specify that key for holding all the subsequent debug subkeys and values. Example:
clearDebugInfo("bbar_test")
To add a subkey and value to appData:
addDebugInfo("control1_text_width",mControlTextWidth)
So this will be stored like this:
appData["debug"]["bbar_test"]["control1_text_width"]
A rectangle can be stored using the rectToFlatLine handler:
addDebugInfo("control1rect",rectToFlatLine(mControlRect))
The result will look like this:
top: 10, bot: 30, left: 15, right: 55, hgt: 20, wdt: 40