|
Mach Modules Documentation
Lua Module API Documentation
|
Go to the source code of this file.
Functions | |
| GUIModule scrError | GetMsg () |
| Get a human-readable description for a screen API error code. | |
| GUIModule scrError | GetMsgCount () |
| Get the total number of recognized screen API error codes. | |
| GUIModule | api_e (meta, api_func,...) |
| Call a screen API function with error handling and optional error code suppression. | |
| returns (excluding the error code) | |
| Call a screen API function without metadata, forwarding all arguments. | |
| GUIModule | api (...) |
| Call a screen API function without metadata, forwarding all arguments. | |
| GUIModule | RunHooks (hook_name,...) |
| Execute hook functions registered across user and machine screen modules. | |
| GUIModule | GetInstanceCount () |
| Get the number of active Mach4 instances. | |
| GUIModule | IsScreenLoaded () |
| Check whether the MachGUI screen has finished loading. | |
| GUIModule | GetCleanedLabel (object_name) |
| Get the cleaned label text of a screen control, with newlines replaced by spaces. | |
| GUIModule | ConvertToLegalVariableName (name) |
| Convert an arbitrary string to a legal Lua variable name. | |
| GUIModule | GetObjectNameCore (object_name) |
| Extract the base name of a screen control by removing any trailing index suffix. | |
| GUIModule | GetObjectPasswordLevelAsValue (object_name) |
| Get the password protection level of a screen object as a numeric value. | |
| GUIModule | GetObjectPasswordLevel (object_name) |
| Get the password protection level string for a screen object. | |
| GUIModule | SetObjectPasswordLevel (object_name, level) |
| Set the password protection level for a screen object. | |
| SpecificScreenModule | SwitchSpecialMode (curr_mode, prev_mode,...) |
| SpecificScreenModule | SwitchSpecialMode (curr_mode, prev_mode, ctrl_name,...) |
| GUIModule | ScreenToggleButtonCall (handler, ctrl_name, event_source,...) |
| SpecificScreenModule | HandleActionButton1 (direction, amount,...) |
| SpecificScreenModule | HandleActionButton1 (direction, amount, ctrl_name,...) |
| GUIModule | ScreenButtonCall (handler, ctrl_name, event_source, ctrl_type,...) |
| ThisScreenModule | ModifyAxisDROPosition_Screen (dro_new_value, AxisID,...) |
| GUIModule | ScreenDROModify (handler, new_value, ctrl_name, event_source,...) |
| GUIModule | MachButtonCall (mach_func_name, control_name, event_source, ctrl_type,...) |
| GUIModule | ScreenTabEnter (...) |
| Handle the enter event for a notebook tab, with password protection support. | |
| GUIModule | ScreenTabExit (...) |
| Handle the exit event for a notebook tab. | |
| GUIModule | ScreenPageChanging (...) |
| Notify the screen module that a notebook page is about to change. | |
| GUIModule | ScreenPageChanged (...) |
| Notify the screen module that a notebook page change has completed. | |
| GUIModule | IsObject (name) |
| Determine whether a screen control name refers to a base or indexed control. | |
| GUIModule | DoesHaveProperty (name, datatype) |
| Check whether a screen control has a specified property. | |
| GUIModule | SetHidden (name, dummy_unused, make_hidden) |
| Set the hidden state of a screen control using a position-based workaround. | |
| GUIModule | GetHidden (name, dummy_unused) |
| Get the hidden state of a screen control. | |
| GUIModule | ShowGroupInnards (group_name, show) |
| Show or hide all child controls within a group screen object. | |
| GUIModule | FormatDRO (name, enabled) |
| Set the visual format of a DRO control to indicate enabled or read-only state. | |
| GUIModule | orig_SetObject (name, datatype, val, force) |
| Set a property value on a screen control and all its indexed variants (original implementation). | |
| GUIModule | ObjectCacheClear () |
| Clear the object property cache. | |
| GUIModule ObjectCache | FindObjects () |
| Find and cache all screen controls matching a given base name. | |
| GUIModule | SetObject (name, property, val, force) |
| Intelligently set a property value on a screen control and all its indexed variants. | |
| GUIModule | GetObject (name, datatype) |
| Get a property value from a named screen control. | |
| GUIModule | GetDropDownSelectedIndex (name) |
| Get the currently selected index and value of a drop-down screen control. | |
| GUIModule | SetDropDownSelectedIndex (name, idx) |
| Set the selected item of a drop-down control by zero-based index. | |
| GUIModule | GetMMToggleButtonWidthPixel (name) |
| Determine the standard pixel-width bucket for an MM toggle button. | |
| GUIModule | SetMMToggleButton (name, value) |
| Set the visual state of an MM toggle button by updating its image property. | |
| GUIModule | GetMMToggleButton (name) |
| Get the current toggle state of an MM toggle button by reading its image property. | |
| GUIModule | SetAxisObject (name, datatype, val, axis) |
| Set a property of axis-associated screen controls, respecting axis enabled state. | |
| GUIModule | SetLED (name, val) |
| Set the value of an LED screen control. | |
| GUIModule | GetLED (name) |
| Get the current value of an LED screen control. | |
| GUIModule | SetLabelLED (name, color, val) |
| Set the background color of a label or button control to indicate an LED state. | |
| GUIModule | SetButtonLED (name, val, color) |
| Set the LED state of a button control using color and value. | |
| GUIModule | SetDRO (name, val) |
| Set the value of a DRO screen control. | |
| GUIModule | GetDRO (name) |
| Get the current numeric value of a DRO screen control. | |
| GUIModule | StartScrollDRO (name, val, minimum, maximum) |
| Activate the scroll DRO mechanism. | |
| GUIModule | StartScrollDRO () |
| Activate the scroll DRO mechanism. | |
| GUIModule | StopScrollDRO (name) |
| Deactivate the scroll DRO mechanism. | |
| GUIModule | StopScrollDRO () |
| Deactivate the scroll DRO mechanism. | |
| GUIModule | UpdateScrollDRO () |
| Update the scroll DRO state machine, advancing or resetting the scrolling DRO value. | |
| GUIModule | PlusMinusDRO (name, val, startscrolling, minimum, maximum) |
| Increment or decrement a DRO value by a specified amount, with optional scroll activation. | |
| GUIModule | DoFunctionName (Name) |
| Execute a named Mach screen function on the current instance. | |
| GUIModule | DoFunctionNameInst (inst, Name) |
| Execute a named Mach screen function on a specific instance. | |
| GUIModule | DoFunctionCode (NumberCode) |
| Execute a Mach screen function by its numeric function code. | |
| GUIModule ScreenObject | Associate (btn_name) |
| Create a new ScreenObject instance associated with a screen control. | |
| GUIModule ScreenObject | UpdatePosition () |
| Read and cache the current position and size of this screen object from the screen. | |
| GUIModule ScreenObject | UpdateState () |
| Update this object's internal state based on detectable conditions. | |
| GUIModule ScreenObject | GetState () |
| Get the internal active state of this screen object. | |
| GUIModule ScreenObject | SetState () |
| Set the internal active state of this screen object. | |
| GUIModule ScreenObject | UpdateScreen () |
| Apply this ScreenObject's position and visibility to the live screen. | |
| GUIModule AxisButton | Associate (btn_name, axis_id) |
| Create a new AxisButton associated with a screen button and an axis. | |
| GUIModule StackableCollection | new (constraints,...) |
| Create a new StackableCollection from layout constraints and an ordered list of ScreenObjects. | |
| GUIModule StackableCollection | Log (...) |
| Log a formatted message for this StackableCollection if debugging is enabled. | |
| GUIModule StackableCollection | FitsHereP () |
| Check whether a screen object fits at the current stacking position. | |
| GUIModule StackableCollection | NextPosition () |
| Advance the current stacking position to the next location where an object can be placed. | |
| GUIModule StackableCollection | Stack () |
| Reposition all items in the collection, hiding inactive or non-fitting objects. | |
| GUIModule | AncestorPath (obj_name) |
| Build a slash-separated ancestor path string for a screen object. | |
| GUIModule LayoutObjects | new (grid_objects) |
| Create a new LayoutObjects instance from a grid configuration table. | |
| GUIModule LayoutObjects | AddToRow (row_id) |
| Add a screen control to a specific row in the layout. | |
| GUIModule LayoutObjects | Layout () |
| Arrange all rows of screen objects into a column-based grid layout. | |
| GUIModule LayoutObjects | Hidden (value) |
| Set the hidden state of a named row in the layout. | |
| GUIModule LayoutObjects | HideRow () |
| Mark a row in the layout as hidden. | |
| GUIModule LayoutObjects | ShowRow () |
| Mark a row in the layout as visible. | |
| filter_fn (...) | |
| Default filter function that accepts all screen objects. | |
| GUIModule | WalkScreenObjectsDFS (obj_name, parent_first, filter_fn) |
| Create a coroutine-based iterator for depth-first traversal of screen objects. | |
| GUIModule | GetListOfChildren (Parent, AllowedTypes, NotAllowedTypes, NotAllowedNames) |
| Get a flat list of screen controls under a given parent, with optional type filtering. | |
| MatchInTable (value, options) | |
| Check whether a value exists in a table of options. | |
| GUIModule | BuildScreenTable (parent) |
| Recursively build a table representing the screen object hierarchy. | |
| GUIModule | GetWholeScreenTable () |
| Get the full screen object hierarchy table, building it if necessary. | |
| GUIModule | TranslateObject (obj) |
| Translate the label of a single screen object using the wxWidgets translation system. | |
| GUIModule | TranslateGroup (obj) |
| Translate all label text in a group and its eligible children. | |
| GUIModule Notebooks | Get () |
| Retrieve a notebook object by name from the Notebooks collection. | |
| GUIModule Notebook | new () |
| Create a new Notebook object and build its tab mapping. | |
| GUIModule Notebook | GetCurrentTab () |
| Get the currently active tab of this notebook. | |
| GUIModule Notebook | IsOnCurrentPage () |
| Determine whether this notebook is on the currently visible screen page. | |
| GUIModule Notebook | GetTabInfoFromLabel () |
| Get notebook tab information by searching for a matching label. | |
| GUIModule Notebooks | BuildMapping () |
| Build the index-to-name mapping for all notebooks in the screen. | |
| GUIModule | StartScreenLoadedCheck () |
| Start the timer that polls for screen load completion. | |
| GUIModule | GetMachStateEnabledControls () |
| Get a cached list of screen controls that have Mach-state-dependent enabled properties. | |
| GUIModule | GetAllControls () |
| Get a cached list of all screen controls. | |
| GUIModule | RefreshStateEnabledControls () |
| Refresh all screen controls that have Mach-state-dependent enabled states. | |
| GUIModule | RefreshControl (obj_name) |
| Force a single screen control to redraw by toggling its Enabled state. | |
| GUIModule | RefreshAllControls (ctrl_type) |
| Refresh all screen controls, optionally filtered by control type. | |
| GUIModule LayoutObjects AddToRow | ( | row_id | ) |
Add a screen control to a specific row in the layout.
Adds the given object name to the ordered list of objects for the specified row_id in the ObjectsInRows table. If ObjectsInRows does not yet exist it is initialized. If the specified row does not yet exist, it is created with Hidden set to false. Multiple calls with the same row_id append objects to that row in order.
| obj_name | (string) The screen control name to add to the row |
| row_id | (number) The row index to add the object to |
| GUIModule AncestorPath | ( | obj_name | ) |
Build a slash-separated ancestor path string for a screen object.
Recursively walks up the screen object hierarchy using scr.GetCtrlParent() to construct a path string from the root down to the specified object. Useful for identifying objects in error messages when the screen editor path is needed. Returns an empty string if obj_name is nil. Returns an error-prefixed string if the screen API returns an error. The base case is when an object is its own parent (root).
| obj_name | (string|nil) The screen control name to build the path for |
| GUIModule api | ( | ... | ) |
Call a screen API function without metadata, forwarding all arguments.
Convenience wrapper around GUIModule.api_e() that passes nil as the metadata argument. Use this when no error codes need to be ignored or suppressed.
| ... | (any) The screen API function name followed by its arguments, forwarded directly to GUIModule.api_e() |
| GUIModule api_e | ( | meta | , |
| api_func | , | ||
| ... ) |
Call a screen API function with error handling and optional error code suppression.
Looks up the named function in the scr API table and invokes it via w.pcall() with the provided arguments. Raises a Lua error via WrapperModule.Error() if the function name is not found or if Lua itself raises an error during the call. Checks the last return value for a Mach screen error code (scr.SERROR_NOERROR); if an error is returned and is not in the meta.Ignore list, raises a Lua error with a descriptive message. On success, strips w.pcall()'s status flag and the trailing error code from the return values and returns only the meaningful results.
| meta | (table|nil) Behavioral metadata table. Supports key 'Ignore' (array of scr error codes to suppress) |
| api_func | (string) The name of the screen API function to call (looked up in the scr table) |
| ... | (any) Arguments to pass to the screen API function |
| GUIModule ScreenObject Associate | ( | btn_name | ) |
Create a new ScreenObject instance associated with a screen control.
Constructs a new ScreenObject by setting its metatable, storing the control name, and reading the current position from the screen via UpdatePosition(). Also calls UpdateState() to initialize the active state. Raises a Lua error if the control cannot be found in the screen. The IsDebugging flag is initialized from w.IsDebugging().
| btn_name | (string) The screen control name (or base name) to associate with this object |
| GUIModule AxisButton Associate | ( | btn_name | , |
| axis_id | ) |
Create a new AxisButton associated with a screen button and an axis.
Creates a new AxisButton instance by calling GUIModule.ScreenObject.Associate() for the given button name and then applying the AxisButton metatable. Sets the internal type label to 'AxisBtn' and stores the axis_id. Calls UpdateState() to initialize the active state based on whether the associated axis is currently enabled.
| btn_name | (string) The screen control name of the button to associate |
| axis_id | (number) The axis index to bind to this button (mc.X_AXIS, mc.Y_AXIS, etc.; use -1 for no axis) |
| GUIModule Notebooks BuildMapping | ( | ) |
Build the index-to-name mapping for all notebooks in the screen.
Walks the entire screen object hierarchy to find all notebook controls (scr.CTYPE_NOTEBOOK) and builds a GUIModule.Notebook object for each one. Also builds a page list (h.screen_page_list) mapping page control names to their zero-based indices. The resulting notebook objects are stored in the GUIModule.Notebooks table keyed by notebook control name. This function is called automatically when the screen finishes loading.
| GUIModule BuildScreenTable | ( | parent | ) |
Recursively build a table representing the screen object hierarchy.
Starting from the given parent control (or the screen root if nil), enumerates all child controls using scr.EnumCtrlChildren() and builds a nested table structure. Each entry contains the parent name, control name, control type, and a children sub-table. Children with their own children are recursively processed.
| parent | (string|nil) The name of the parent screen control to start from. If nil, uses scr.GetScreenName() |
| GUIModule ConvertToLegalVariableName | ( | name | ) |
Convert an arbitrary string to a legal Lua variable name.
Replaces all characters that are not alphanumeric or underscores with underscores, and prepends a leading underscore. This is used to generate meaningful but syntactically valid Lua identifiers from arbitrary screen object labels or names.
| name | (string) The string to convert into a legal Lua variable name |
References name().
| GUIModule DoesHaveProperty | ( | name | , |
| datatype | ) |
Check whether a screen control has a specified property.
Attempts to resolve the control name by checking both the exact name and the "(1)" indexed variant. Then calls scr.IsProperty() to test for the given property name. Returns true only if the screen API returns scr.SERROR_NOERROR and confirms the property exists.
| name | (string) The screen control name to check |
| datatype | (string) The property name to test for (e.g., "Label", "Value", "Hidden") |
References name().
| GUIModule DoFunctionCode | ( | NumberCode | ) |
Execute a Mach screen function by its numeric function code.
Calls scr.DoFunctionCodeInst() with the current Mach instance and the provided function code. If the call returns an error, reports it via w.FunctionError().
| NumberCode | (string|number) The numeric function code to execute via the screen API |
| GUIModule DoFunctionName | ( | Name | ) |
Execute a named Mach screen function on the current instance.
Calls scr.DoFunctionNameInst() with the current Mach instance and the provided function name. If the call returns an error, reports it via w.FunctionError().
| Name | (string) The name of the screen function to execute |
| GUIModule DoFunctionNameInst | ( | inst | , |
| Name | ) |
Execute a named Mach screen function on a specific instance.
Calls scr.DoFunctionNameInst() with the provided instance handle and function name. If the call returns an error, reports it via w.FunctionError(). If inst is not a number, falls back to mc.mcGetInstance().
| inst | (number) The Mach4 instance handle. If not provided, uses current instance |
| Name | (string) The name of the screen function to execute |
| filter_fn | ( | ... | ) |
Default filter function that accepts all screen objects.
This is the default filter function assigned inside GUIModule._WalkDFS() when no filter_fn is provided by the caller. It unconditionally returns true for every control name passed to it, causing all screen objects to be included in the traversal.
| ... | (any) The screen control name (and any additional arguments passed by the walker) |
Referenced by WalkScreenObjectsDFS().
| GUIModule ObjectCache FindObjects | ( | ) |
Find and cache all screen controls matching a given base name.
Looks up the specified base name in the object cache. If found and non-empty, returns the cached result immediately. Otherwise, searches for all matching controls by checking the exact name (index 0) and indexed variants (name(1) through name(30)). For each found control, stores its name, control type, is_numeric flag, property cache table, lookup count, and write count. Results are stored in both self.cache (by base name) and self.direct (by exact control name) for fast lookup.
| name | (string) The base screen control name to search for |
| GUIModule StackableCollection FitsHereP | ( | ) |
Check whether a screen object fits at the current stacking position.
Tests whether placing scr_obj at self.current.top and self.current.left would keep the object's bottom and right edges within the configured maximum height and width limits of the container (accounting for bottom and right padding).
| scr_obj | (table) A ScreenObject instance with Height and Width fields |
| GUIModule FormatDRO | ( | name | , |
| enabled | ) |
Set the visual format of a DRO control to indicate enabled or read-only state.
Updates the "Editor", "Fg Color", and "Bg Color" properties of the named DRO screen control to visually distinguish between an editable and a read-only state. When enabled, sets a keypad editor with a blue-grey background. When disabled, sets read-only mode with a muted foreground and dark background.
| name | (string) The screen control name of the DRO to format |
| enabled | (boolean) True to format as editable (keypad, colored), false to format as read-only (grey) |
References name().
| GUIModule Notebooks Get | ( | ) |
Retrieve a notebook object by name from the Notebooks collection.
Looks up a previously built GUIModule.Notebook object by its control name. Raises a Lua error if the name is nil or if no notebook with that name has been mapped.
| nb_name | (string) The screen control name of the notebook to retrieve |
| GUIModule GetAllControls | ( | ) |
Get a cached list of all screen controls.
Returns the full list of screen controls, building and caching the list on first call via GUIModule.GetListOfChildren(). Subsequent calls return the cached result without querying the screen API again.
| GUIModule GetCleanedLabel | ( | object_name | ) |
Get the cleaned label text of a screen control, with newlines replaced by spaces.
Checks whether the named screen object has a "Label" property. If it does, retrieves the label text and replaces both literal "\n" escape sequences and actual newline characters with spaces. Returns an empty string if the object has no "Label" property.
| object_name | (string) The screen control name to retrieve the label from |
| GUIModule Notebook GetCurrentTab | ( | ) |
Get the currently active tab of this notebook.
Queries the screen API for the "Current Tab" property of the notebook control and returns the corresponding tab info table. Raises an error if the property cannot be read or does not return a valid numeric index. Returns nil if the tab index is -1 (notebook not visible or no current tab).
| GUIModule GetDRO | ( | name | ) |
Get the current numeric value of a DRO screen control.
Retrieves the "Value" property of the named DRO control. If the base name is a valid screen control, reads it directly; otherwise reads from the "(1)" indexed variant. Returns the value converted to a number via tonumber().
| name | (string) The screen control name of the DRO to read |
References name().
| GUIModule GetDropDownSelectedIndex | ( | name | ) |
Get the currently selected index and value of a drop-down screen control.
Reads the "Strings" property of the named drop-down control, splits it by "|" to get the list of options, and compares each option against the current "Value" property. Returns the zero-based index of the matching option and its string value. Returns -1 as the index if no match is found.
| name | (string) The screen control name of the drop-down to query |
References name().
| GUIModule GetHidden | ( | name | , |
| dummy_unused | ) |
Get the hidden state of a screen control.
Returns the hidden state of the named screen control as "1" (hidden) or "0" (visible). For toolpath controls (scr.CTYPE_TOOLPATH), uses the standard "Hidden" property directly. For all other controls, computes the hidden state by checking if the "Left" property value is >= 10000 (the threshold used by GUIModule.SetHidden()) OR if the "Hidden" property is "1". Returns "0" if the Left value cannot be converted to a number. Reports an error via w.FunctionError() if the control type cannot be retrieved.
| name | (string) The screen control name to query |
| dummy_unused | (any) Unused parameter; present for API symmetry with scr.GetProperty() |
References name().
| GUIModule GetInstanceCount | ( | ) |
Get the number of active Mach4 instances.
Wraps scr.GetInstanceCount() to return the current number of running Mach4 instances available to the screen.
| GUIModule GetLED | ( | name | ) |
Get the current value of an LED screen control.
Reads the "Value" property of the named LED control and returns it as a number. If the base name is a valid screen control, reads it directly; otherwise reads from the "(1)" indexed variant.
| name | (string) The screen control name of the LED to read |
References name().
| GUIModule GetListOfChildren | ( | Parent | , |
| AllowedTypes | , | ||
| NotAllowedTypes | , | ||
| NotAllowedNames | ) |
Get a flat list of screen controls under a given parent, with optional type filtering.
Retrieves the full screen hierarchy table and extracts all controls under the specified parent. If parent is nil or the screen root, the entire screen is searched. Otherwise, recursively scans the hierarchy to locate the parent's subtree before filtering. Supports filtering by allowed types, excluded types, and excluded names.
| Parent | (string|nil) The name of the parent control to search under. If nil, searches the entire screen |
| AllowedTypes | (table|nil) Array of scr.CTYPE_* values to include. If nil, all types are included |
| NotAllowedTypes | (table|nil) Array of scr.CTYPE_* values to exclude |
| NotAllowedNames | (table|nil) Array of base control names to exclude |
| GUIModule GetMachStateEnabledControls | ( | ) |
Get a cached list of screen controls that have Mach-state-dependent enabled properties.
Walks the entire screen object tree and collects controls that have either "Enabled States" or "Enable With Machine" properties set to a non-zero value. The resulting list is cached in GUIModule._MachStateEnabledControls so that subsequent calls do not re-walk the screen tree.
| GUIModule GetMMToggleButton | ( | name | ) |
Get the current toggle state of an MM toggle button by reading its image property.
Reads the "Image" property of the named toggle button and compares it against the expected "on" image filename for the button's pixel width. Returns true if the button is in the on state, false otherwise.
| name | (string) The screen control name of the MM toggle button |
References name().
| GUIModule GetMMToggleButtonWidthPixel | ( | name | ) |
Determine the standard pixel-width bucket for an MM toggle button.
Reads the "Width" property of the named button and maps it to the nearest standard image width: 65, 75, 85, or 95 pixels. This value is used to select the correct on/off image filename for the toggle button.
| name | (string) The screen control name of the MM toggle button |
References name().
| GUIModule scrError GetMsg | ( | ) |
Get a human-readable description for a screen API error code.
Looks up the provided error code in the GUIModule.scrError.ErrorCodes table. If the code is not recognized, returns a string indicating the unrecognized code. Otherwise, returns a formatted string combining the description, the symbolic name, and the numeric code.
| errorcode | (number) The screen API error code to look up |
| GUIModule scrError GetMsgCount | ( | ) |
Get the total number of recognized screen API error codes.
Counts the entries in the GUIModule.scrError.ErrorCodes table using GUIModule.GetTableCount() and returns the result.
| GUIModule GetObject | ( | name | , |
| datatype | ) |
Get a property value from a named screen control.
Retrieves the specified property from the screen control with the given name. If a control named "name(1)" exists, reads from that indexed variant; otherwise reads directly from the base name. Uses the custom GUIModule.GetHidden() function when the "Hidden" property is requested. Reports an error via w.FunctionError() if the screen API returns a non-zero error code, but still returns whatever value was retrieved.
| name | (string) The screen control name (or base name) to read from |
| datatype | (string) The property name to retrieve (e.g., "Value", "Label", "Hidden") |
References name().
| GUIModule GetObjectNameCore | ( | object_name | ) |
Extract the base name of a screen control by removing any trailing index suffix.
Searches for the last opening parenthesis in the name string and returns everything before it (minus the trailing parenthesis). If no parenthesis is found, the full string is returned unchanged. For example, "MyButton(2)" returns "MyButton".
| object_name | (string) The full screen control name, possibly with an index suffix such as "(1)" |
| GUIModule GetObjectPasswordLevel | ( | object_name | ) |
Get the password protection level string for a screen object.
Reads the password level for the specified screen object from the Mach4 profile under the "MachMotionPasswords" section. The object name is first normalized by stripping any index suffix via GUIModule.GetObjectNameCore(). Returns "Unprotected" if no entry exists for the object.
| object_name | (string) The screen control name to query the password level for |
| GUIModule GetObjectPasswordLevelAsValue | ( | object_name | ) |
Get the password protection level of a screen object as a numeric value.
Retrieves the password level string via GUIModule.GetObjectPasswordLevel() and converts it to a numeric value. "Unprotected" returns 0; all other levels return the numeric digit found at the end of the level string (e.g., "Level1" returns 1).
| object_name | (string) The screen control name to query |
| HeightControllers GetState | ( | ) |
Get the internal active state of this screen object.
Get the current state of the height controller as a string.
Base class stub that returns an empty string. Subclasses such as NeuronTHC may override this method to return a meaningful state string describing the current operating mode or process sequence of the controller.
| GUIModule Notebook GetTabInfoFromLabel | ( | ) |
Get notebook tab information by searching for a matching label.
Iterates through all tabs in the notebook looking for one whose label matches the provided string. Raises an error if no tab with the given label is found.
| label | (string) The label text of the tab to find |
| GUIModule GetWholeScreenTable | ( | ) |
Get the full screen object hierarchy table, building it if necessary.
Returns the cached screen table (h.screen_table). If the cache is empty or nil, calls GUIModule.BuildScreenTable() to construct it. The table is stored in h.screen_table for subsequent calls.
| SpecificScreenModule HandleActionButton1 | ( | direction | , |
| amount | , | ||
| ctrl_name | , | ||
| ... ) |
| SpecificScreenModule HandleActionButton1 | ( | direction | , |
| amount | , | ||
| ... ) |
| GUIModule LayoutObjects Hidden | ( | value | ) |
Set the hidden state of a named row in the layout.
Searches ObjectsInRows for a row whose "Name" key matches the provided name and sets its "Hidden" key to the specified value. Only the first matching row is updated. Has no effect if no row with the given name is found.
| name | (string) The name identifier of the row to update |
| value | (boolean) The hidden state to assign - true to hide, false to show |
| GUIModule LayoutObjects HideRow | ( | ) |
Mark a row in the layout as hidden.
Sets the Hidden flag of the specified row to true in the ObjectsInRows table. If ObjectsInRows or the specified row does not exist, it is initialized before setting the visibility. The row will be hidden during the next call to Layout().
| row_id | (number) The index of the row to hide |
| GUIModule IsObject | ( | name | ) |
Determine whether a screen control name refers to a base or indexed control.
-------------------— Screen Controls ----------------------—
Checks whether the given name exists as a plain control or as an indexed control (name(1)). Returns false if the plain name is a control (meaning no index suffix needed), true if the "(1)" variant exists (meaning the name is a base for indexed controls), or nil if neither form is found.
| name | (string|any) The screen control name to test; non-strings are converted via tostring() |
References name().
| GUIModule Notebook IsOnCurrentPage | ( | ) |
Determine whether this notebook is on the currently visible screen page.
Compares the notebook's associated page index against the currently active screen page. If the notebook has no associated page (page_index == -1), it is considered always visible.
| GUIModule IsScreenLoaded | ( | ) |
Check whether the MachGUI screen has finished loading.
Wraps scr.IsLoaded() to report whether the screen is fully initialized and ready for interaction.
| GUIModule LayoutObjects Layout | ( | ) |
Arrange all rows of screen objects into a column-based grid layout.
Iterates through all rows in ObjectsInRows and positions each visible object using the configured padding, column spacing, and within-column spacing. Hidden rows have all their controls set to Hidden="1". Visible rows are stacked vertically; when a row would exceed the Limits.Height, a new column is started. Objects within a row are arranged horizontally with per-object or default spacing. Vertically centers shorter objects within a row relative to the tallest object. Optionally resizes the container control vertically to fit all content. Calls w.FunctionCompleted() on completion.
| GUIModule StackableCollection Log | ( | ... | ) |
Log a formatted message for this StackableCollection if debugging is enabled.
Wraps w.Log() with a standard prefix identifying the collection's container group name. Only outputs the message if self.IsDebugging is true. Accepts a format string and variadic arguments in the same style as string.format().
| fmt | (string) A format string passed to string.format() with the group name prepended |
| ... | (any) Additional arguments for the format string |
| GUIModule MachButtonCall | ( | mach_func_name | , |
| control_name | , | ||
| event_source | , | ||
| ctrl_type | , | ||
| ... ) |
| MatchInTable | ( | value | , |
| options | ) |
Check whether a value exists in a table of options.
Iterates through the options table looking for a value that matches the provided value using equality comparison. Returns false if options is nil or not a table.
| value | (any) The value to search for |
| options | (table|nil) An array of values to search within |
| ThisScreenModule ModifyAxisDROPosition_Screen | ( | dro_new_value | , |
| AxisID | , | ||
| ... ) |
| GUIModule Notebook new | ( | ) |
Create a new Notebook object and build its tab mapping.
Constructs a new GUIModule.Notebook instance for the given notebook control name. Enumerates all child controls (tabs) of the notebook, skipping hidden tabs, and builds a bidirectional mapping in the 'tabs' table (indexed by both tab index and tab name). Also determines which screen page the notebook resides on by walking up the parent hierarchy to find an ancestor of type scr.CTYPE_PAGE.
| nb_name | (string) The screen control name of the notebook (scr.CTYPE_NOTEBOOK) |
| GUIModule StackableCollection new | ( | constraints | , |
| ... ) |
Create a new StackableCollection from layout constraints and an ordered list of ScreenObjects.
Constructs and returns a new StackableCollection instance. Normalizes all constraint fields into lowercase internal forms for consistent access. Requires a ContainerName and Order to be specified; raises an error if either is missing. Supports the following constraint keys:
| constraints | (table) Layout constraint configuration table (see details above) |
| ... | (any) One or more ScreenObject instances (or subclass instances) to include in the collection |
| GUIModule LayoutObjects new | ( | grid_objects | ) |
Create a new LayoutObjects instance from a grid configuration table.
Constructs a new LayoutObjects object by copying all key-value pairs from the provided grid_objects configuration table into the new instance. The configuration table supports the following keys:
| grid_objects | (table) Configuration table defining layout constraints and container info |
| GUIModule StackableCollection NextPosition | ( | ) |
Advance the current stacking position to the next location where an object can be placed.
Updates self.current (with 'top' and 'left' fields) to the next available position for the given screen object based on the collection's configured stacking order. Supports three modes: 1-D vertical, 1-D horizontal, and 2-D (vertical-then-horizontal or horizontal-then-vertical). Returns true if a valid position was found within the group's size limits, false if no more space is available. This function must be called after successfully placing an object to advance past it.
| scr_obj | (table) A ScreenObject instance whose Width and Height are used for position calculations |
| GUIModule ObjectCacheClear | ( | ) |
Clear the object property cache.
Resets GUIModule.ObjectCache.cache to an empty table, invalidating all cached screen object metadata. The next call to SetObject() or ObjectCache:FindObjects() will re-query the screen API for object information.
| GUIModule orig_SetObject | ( | name | , |
| datatype | , | ||
| val | , | ||
| force | ) |
Set a property value on a screen control and all its indexed variants (original implementation).
Original version of SetObject(), retained for reference during active testing of the new cached implementation. Sets the specified property for all controls matching the given base name, including indexed variants (name(1), name(2), ...). For numeric controls (sliders, gauges, DROs) setting the "Value" property, only updates if the difference exceeds 0.0001. For non-numeric properties, only updates if the string value has changed. The "Hidden" property uses GUIModule.SetHidden() and GUIModule.GetHidden() instead of the standard scr API functions. Boolean values are automatically converted to "1"/"0". Reports errors via w.FunctionError().
| name | (string) The base screen control name to set |
| datatype | (string) The property name to set (e.g., "Value", "Label", "Hidden", "Enabled") |
| val | (string|number|boolean) The new value; booleans are converted to "1"/"0", others to string |
| force | (boolean|nil) If true, sets the property unconditionally without comparing to current value. Defaults to false |
References name().
| GUIModule PlusMinusDRO | ( | name | , |
| val | , | ||
| startscrolling | , | ||
| minimum | , | ||
| maximum | ) |
Increment or decrement a DRO value by a specified amount, with optional scroll activation.
Reads the current value of the named DRO, adds the specified delta, and applies optional min/max clamping from the GUIMODULE_SCROLL_DRO table. The new value is written back via the DRO's associated Register, Parameter, or directly to the screen object. If startscrolling is true, activates the scroll DRO mechanism for continuous adjustment. Returns an error if the name is not a string, the value is not a number, or the object cannot be found.
| name | (string) The screen control name of the DRO to modify |
| val | (number) The amount to add to the current DRO value (may be negative) |
| startscrolling | (boolean) If true, activates the scroll DRO for continuous adjustment |
| minimum | (number|nil) Optional minimum value clamp. If nil, uses the existing scroll DRO minimum |
| maximum | (number|nil) Optional maximum value clamp. If nil, uses the existing scroll DRO maximum |
References name().
| GUIModule RefreshAllControls | ( | ctrl_type | ) |
Refresh all screen controls, optionally filtered by control type.
Iterates through all screen controls and forces each one to redraw by toggling its Enabled state. This is a workaround for controls that do not properly reflect their state after Mach state changes, particularly when modal dialogs are involved. After refreshing controls, executes the "RefreshAllControls" hook. Performance metrics (control count and elapsed time) are logged on completion.
| ctrl_type | (number|nil) Optional control type filter (e.g., scr.CTYPE_BUTTON). If nil, all controls are refreshed |
| GUIModule RefreshControl | ( | obj_name | ) |
Force a single screen control to redraw by toggling its Enabled state.
Reads the current Enabled state of the control, temporarily sets it to the opposite value, then restores the original value. This causes the MachGUI renderer to redraw the control, correcting any visual state inconsistencies that may occur when Mach changes states while a modal dialog is open.
| obj_name | (string) The name of the screen control to refresh |
| GUIModule RefreshStateEnabledControls | ( | ) |
Refresh all screen controls that have Mach-state-dependent enabled states.
Retrieves the cached list of controls that have "Enabled States" or "Enable With Machine" properties set, then toggles each control's Enabled state to force a redraw. This is a targeted workaround for controls that fail to render correctly when a modal dialog is open during a Mach state change. Executes the "RefreshStateEnabledControls" hook after refreshing. Performance metrics are logged.
| returns | ( | excluding the error | code | ) |
Call a screen API function without metadata, forwarding all arguments.
Convenience wrapper around GUIModule.api_e() that passes nil as the metadata argument. Use this when no error codes need to be ignored or suppressed.
| ... | (any) The screen API function name followed by its arguments, forwarded directly to GUIModule.api_e() |
| GUIModule RunHooks | ( | hook_name | , |
| ... ) |
Execute hook functions registered across user and machine screen modules.
Searches for and executes hook functions in a fixed priority order, from most specific to most general: user[hook_name], user["User"..hook_name], m.screen["Machine"..hook_name], m.screen[hook_name], m["Machine"..hook_name]. Each hook is called via w.pcall() for protected execution. A hook returning (false, b, c) with b == false signals a fatal error and stops further processing. A hook returning (false, b, c) with b ~= false signals successful completion and stops further processing. If all hooks run without stopping, returns true.
| hook_name | (string) The base name of the hook to search for and execute |
| ... | (any) Additional arguments passed through to each hook function |
| GUIModule ScreenButtonCall | ( | handler | , |
| ctrl_name | , | ||
| event_source | , | ||
| ctrl_type | , | ||
| ... ) |
| GUIModule ScreenDROModify | ( | handler | , |
| new_value | , | ||
| ctrl_name | , | ||
| event_source | , | ||
| ... ) |
| GUIModule ScreenPageChanged | ( | ... | ) |
Notify the screen module that a notebook page change has completed.
If m.screen.ScreenPageChanged is defined, constructs a notebook info table with the notebook name, the new tab's label, the previous tab index, and the current tab index, then invokes m.screen.ScreenPageChanged via w.ProtectedMsg(). Has no effect if the handler is not defined.
| ... | (any) Variadic parameters from MachGUI: notebook name, unused, old tab index, new tab index |
| GUIModule ScreenPageChanging | ( | ... | ) |
Notify the screen module that a notebook page is about to change.
If m.screen.CommonScreenPageChanged is defined, constructs a notebook info table with the notebook name, the future tab's label, the current tab index, and the future tab index, then invokes the handler via w.ProtectedMsg(). Returns the handler's result, or true if no handler is defined (allowing the page change to proceed).
| ... | (any) Variadic parameters from MachGUI: notebook name, unused, current tab index, future tab index |
| GUIModule ScreenTabEnter | ( | ... | ) |
Handle the enter event for a notebook tab, with password protection support.
Called when the user switches to a tab. Reads the tab name and parent notebook from the variadic parameters, then executes the main logic inside a protected message handler. Waits until the screen is fully loaded before proceeding. Checks the tab's password protection level and, if protected, invokes w.PasswordProtection(); on failure, restores the previous tab and returns an error. Logs the tab change, updates the current tab number, and if m.screen.CommonScreenTabEnter is defined, constructs a tab info table and calls the handler.
| ... | (any) Variadic parameters from MachGUI: the first value is the tab control name |
| GUIModule ScreenTabExit | ( | ... | ) |
Handle the exit event for a notebook tab.
Called when the user leaves a tab. Reads the tab name and parent notebook from the variadic parameters, retrieves the cleaned label for logging, and caches the current tab index if not already cached. Logs the exit event. If m.screen.CommonScreenTabExit is defined, constructs a tab info table (name, label, index, parent) and invokes the handler via w.ProtectedMsg().
| ... | (any) Variadic parameters from MachGUI: the first value is the tab control name |
| GUIModule ScreenToggleButtonCall | ( | handler | , |
| ctrl_name | , | ||
| event_source | , | ||
| ... ) |
| GUIModule SetAxisObject | ( | name | , |
| datatype | , | ||
| val | , | ||
| axis | ) |
Set a property of axis-associated screen controls, respecting axis enabled state.
Iterates through all indexed variants of the named control (name(1), name(2), ...) and sets the specified property. For properties that relate to visibility or enablement ("Enabled", "Fg Color", "Hidden", "Left"), the actual value applied depends on whether the given axis is enabled in the current selected instance. Disabled axes force controls to appear disabled, grey, hidden, or moved off-screen respectively. Other properties are not modified.
| name | (string) The base screen control name to set |
| datatype | (string) The property name to set (e.g., "Enabled", "Fg Color", "Hidden", "Left") |
| val | (string|number) The value to apply when the axis is enabled |
| axis | (number) The axis index used to check enabled state (mc.X_AXIS, mc.Y_AXIS, etc.) |
References name().
| GUIModule SetButtonLED | ( | name | , |
| val | , | ||
| color | ) |
Set the LED state of a button control using color and value.
Convenience wrapper that calls GUIModule.SetLabelLED() with the color and value arguments reordered to match the button-centric calling convention.
| name | (string) The screen control name of the button LED to set |
| val | (boolean|number) The LED state - true or non-zero for on, false or zero for off |
| color | (string|nil) The color name for the LED (e.g., "GREEN", "RED"). Defaults to "GREEN" if nil |
References name().
| GUIModule SetDRO | ( | name | , |
| val | ) |
Set the value of a DRO screen control.
Sets the "Value" property of all matching DRO screen controls with the given name. Checks the base name first, then iterates through indexed variants (name(1), name(2), ...). Only calls scr.SetProperty() if the current value differs from the new value, minimizing unnecessary screen API calls.
| name | (string) The screen control name (or base name) of the DRO to set |
| val | (string|number) The value to set; converted to string if not already |
References name().
| GUIModule SetDropDownSelectedIndex | ( | name | , |
| idx | ) |
Set the selected item of a drop-down control by zero-based index.
Reads the "Strings" property of the named drop-down control, splits it by "|" to get the list of options, and sets the "Value" property to the string at the specified index. Reports an error via w.FunctionError() if the index is out of range.
| name | (string) The screen control name of the drop-down to set |
| idx | (number) The zero-based index of the option to select |
References name().
| GUIModule SetHidden | ( | name | , |
| dummy_unused | , | ||
| make_hidden | ) |
Set the hidden state of a screen control using a position-based workaround.
Implements hide/unhide behavior that works reliably across all control types. For toolpath controls (scr.CTYPE_TOOLPATH), uses the standard "Hidden" property directly. For all other controls, hides by adding 10000 to the "Left" property (moving off-screen) and unhides by subtracting 10000. This workaround is used because the standard "Hidden" property does not behave consistently for all control types in MachGUI. The ObjectCache is updated whenever Left is modified to keep cached values consistent, and the cached "Hidden" value is removed to force recalculation on next read.
| name | (string) The screen control name to show or hide |
| dummy_unused | (any) Unused parameter; present for API symmetry with scr.SetProperty() |
| make_hidden | (string) "1" to hide the control, "0" to show it |
References name().
| GUIModule SetLabelLED | ( | name | , |
| color | , | ||
| val | ) |
Set the background color of a label or button control to indicate an LED state.
Sets the background and foreground colors of all matching screen controls based on the provided color name and boolean/numeric state value. Supports both button controls (scr.CTYPE_BUTTON) and all other control types, each with their own color table per color name. Supported color names include: "GREEN", "RED", "BLUE", "YELLOW", "ORANGE", "GREY", "WHITE", and color scheme variants prefixed with "COLORSCHEME_" (e.g., "COLORSCHEME_GREEN", "COLORSCHEME_MUTED_RED"). Iterates through all indexed variants of the control name.
| name | (string) The screen control name (or base name) of the LED label or button |
| color | (string) The color name to use for on/off states. Defaults to "GREEN" if unrecognized |
| val | (boolean|number|nil) State value - true or non-zero sets the on color; false or zero sets the off color |
References name().
| GUIModule SetLED | ( | name | , |
| val | ) |
Set the value of an LED screen control.
Sets the "Value" property of all matching LED screen controls with the given name. Checks the base name first, then iterates through indexed variants (name(1), name(2), ...). Only calls scr.SetProperty() if the current value differs from the new value. Accepts boolean values, converting true to "1" and false to "0" automatically.
| name | (string) The screen control name (or base name) of the LED to set |
| val | (boolean|string|number) The value to set; booleans are converted to "1"/"0" |
References name().
| GUIModule SetMMToggleButton | ( | name | , |
| value | ) |
Set the visual state of an MM toggle button by updating its image property.
Determines the correct on/off image filename based on the button's pixel width and sets the "Image" property of the screen control accordingly. The image filenames follow the pattern "On{px}px.png" and "Off{px}px.png" where {px} is the width bucket.
| name | (string) The screen control name of the MM toggle button to update |
| value | (boolean) The desired state - true for on, false for off |
References name().
| GUIModule SetObject | ( | name | , |
| property | , | ||
| val | , | ||
| force | ) |
Intelligently set a property value on a screen control and all its indexed variants.
Sets the specified property for all controls matching the given base name, including indexed variants (name(1), name(2), ...). Uses the GUIModule.ObjectCache to minimize unnecessary screen API calls by comparing the new value against the cached or current value. For numeric controls (sliders, gauges, DROs) setting the "Value" property, only updates if the difference exceeds 0.0001. For non-numeric properties, only updates if the value has changed. The "Hidden" property uses GUIModule.SetHidden() and GUIModule.GetHidden() instead of the standard scr.SetProperty()/scr.GetProperty() functions. The "Current Tab" property is always set unconditionally. Boolean values are automatically converted to "1"/"0".
| name | (string) The base screen control name to set |
| property | (string) The property name to set (e.g., "Value", "Label", "Hidden", "Enabled") |
| val | (string|number|boolean) The new value; booleans are converted to "1"/"0", others to string |
| force | (boolean|nil) If true, sets the property unconditionally without comparing to current value. Defaults to false |
References name().
| GUIModule SetObjectPasswordLevel | ( | object_name | , |
| level | ) |
Set the password protection level for a screen object.
Writes the password level string for the specified screen object to the Mach4 profile under the "MachMotionPasswords" section. The object name is first normalized by stripping any index suffix via GUIModule.GetObjectNameCore().
| object_name | (string) The screen control name to assign a password level to |
| level | (string) The password level string to assign (e.g., "Level1", "Unprotected") |
| GUIModule ScreenObject SetState | ( | ) |
Set the internal active state of this screen object.
| new_state | (boolean) The new active state - true to mark as active, false to mark as inactive |
| GUIModule ShowGroupInnards | ( | group_name | , |
| show | ) |
Show or hide all child controls within a group screen object.
If the named control exists in the screen, retrieves all child controls of the group and sets their Hidden property. The show parameter is normalized so that nil, true, 1, or "1" result in showing the children (Hidden="0"), while any other value hides them (Hidden="1"). Has no effect if the group control does not exist.
| group_name | (string) The screen control name of the group whose children to show or hide |
| show | (boolean|number|string|nil) Show state - nil/true/1/"1" to show children, anything else to hide them |
| GUIModule LayoutObjects ShowRow | ( | ) |
Mark a row in the layout as visible.
Sets the Hidden flag of the specified row to false in the ObjectsInRows table. If ObjectsInRows or the specified row does not exist, it is initialized before setting the visibility. The row will be shown during the next call to Layout().
| row_id | (number) The index of the row to show |
| GUIModule StackableCollection Stack | ( | ) |
Reposition all items in the collection, hiding inactive or non-fitting objects.
This is the primary method of the StackableCollection class. It performs the following:
| GUIModule StartScreenLoadedCheck | ( | ) |
Start the timer that polls for screen load completion.
Starts the GUIModule.OnLoadedTimer at 100ms intervals. When the screen reports that it is loaded (scr.IsLoaded()), the timer stops and executes the ScreenIsLoadedScript hooks and builds the notebook tab mapping.
| GUIModule StartScrollDRO | ( | ) |
Activate the scroll DRO mechanism.
Sets the GUIMODULE_SCROLL_DRO["Active"] flag to true if it is not already active, enabling continuous DRO value adjustment on subsequent calls to UpdateScrollDRO().
| GUIModule StartScrollDRO | ( | name | , |
| val | , | ||
| minimum | , | ||
| maximum | ) |
Activate the scroll DRO mechanism.
Sets the GUIMODULE_SCROLL_DRO["Active"] flag to true if it is not already active, enabling continuous DRO value adjustment on subsequent calls to UpdateScrollDRO().
References name().
| GUIModule StopScrollDRO | ( | ) |
Deactivate the scroll DRO mechanism.
Sets the GUIMODULE_SCROLL_DRO["Active"] flag to false, stopping any ongoing DRO scrolling on the next call to UpdateScrollDRO().
| GUIModule StopScrollDRO | ( | name | ) |
Deactivate the scroll DRO mechanism.
Sets the GUIMODULE_SCROLL_DRO["Active"] flag to false, stopping any ongoing DRO scrolling on the next call to UpdateScrollDRO().
References name().
| SpecificScreenModule SwitchSpecialMode | ( | curr_mode | , |
| prev_mode | , | ||
| ctrl_name | , | ||
| ... ) |
| SpecificScreenModule SwitchSpecialMode | ( | curr_mode | , |
| prev_mode | , | ||
| ... ) |
| GUIModule TranslateGroup | ( | obj | ) |
Translate all label text in a group and its eligible children.
Translates the label of the group object itself, then retrieves all child controls of translatable types (static text, buttons, pages, groups, notebook pages, toggle buttons) and translates their labels using wx.wxGetTranslation().
| obj | (string) The screen control name of the group to translate |
| GUIModule TranslateObject | ( | obj | ) |
Translate the label of a single screen object using the wxWidgets translation system.
Checks whether the screen object has a "Label" property. If it does, retrieves the current label text, passes it through wx.wxGetTranslation(), and sets the translated result back on the object.
| obj | (string) The screen control name of the object to translate |
| GUIModule ScreenObject UpdatePosition | ( | ) |
Read and cache the current position and size of this screen object from the screen.
Queries the screen API for the Top, Left, Height, and Width properties of the associated control and stores the numeric values in the corresponding fields of this object. Raises a Lua error if any property cannot be retrieved.
| GUIModule ScreenObject UpdateScreen | ( | ) |
Apply this ScreenObject's position and visibility to the live screen.
Sets the Top and Left properties of the screen control to the values stored in this object. Also sets the Hidden property based on the current state: hidden (1) if state is false, visible (0) if state is true. Logs the update if debugging is enabled.
| GUIModule UpdateScrollDRO | ( | ) |
Update the scroll DRO state machine, advancing or resetting the scrolling DRO value.
Called periodically (e.g., from the PLC script) to manage the scroll DRO behavior. When scrolling is active and was already active, applies a delay before beginning to scroll, then calls PlusMinusDRO() at an accelerating rate based on the total number of scans elapsed. Resets internal counters when scrolling transitions from inactive to active, and clears all state when scrolling transitions from active to inactive.
| GUIModule AxisButton UpdateState | ( | ) |
Update this object's internal state based on detectable conditions.
Update the active state of an AxisButton based on whether its associated axis is enabled.
Base implementation for ScreenObject. At this level, there is no way to discern whether the object ought to be active, so the state is unconditionally set to true. Subclasses should override this method to implement condition-specific logic.
Queries mc.mcAxisIsEnabled() for the button's axis_id using the currently selected instance. If axis_id is outside the valid axis range (mc.AXIS0 to mc.MC_MAX_AXES), the button is unconditionally set to active. If the API call returns an error, logs the error and returns without changing state. Sets internal state to true if the axis is enabled, false if disabled.
| GUIModule WalkScreenObjectsDFS | ( | obj_name | , |
| parent_first | , | ||
| filter_fn | ) |
Create a coroutine-based iterator for depth-first traversal of screen objects.
Wraps GUIModule._WalkDFS() in a coroutine, returning an iterator function suitable for use in a generic for loop. Each call to the iterator resumes the coroutine and returns the next screen object name. Raises a Lua error if the coroutine encounters an error during traversal. Iteration stops when all objects have been visited.
| obj_name | (string|nil) The root screen object to start traversal from. If nil, uses scr.GetScreenName() |
| parent_first | (boolean|nil) If true (default), yield parent before children; if false, yield children first |
| filter_fn | (function|nil) Optional function(ctrl_name) returning true to include the object, false to skip it |
References filter_fn().