Shiny Language Reference
Language Reference > Panel Functions
setpanelboundscheck
setpanelboundscheck(bool EnableCheck);
Sets whether boundary checking is enabled for panel settings
By default Brass ensures that the size and position of the display panel (set by setpanelpos and setpanelsize) never cross the screen boundaries, preventing code bugs from positioning the panel off-screen or or sizing it incorrectly. This can be inconvenient for plugins that need to keep their panels off-screen until a certain condition is set (for example, a sliding panel that only appears when a button is clicked). SETPANELBOUNDSCHECK controls whether Brass should perform the screen boundary checks. By using SETPANELBOUNDSCHECK you can tell Brass that the plugin code will be responsible for making sure it's positioned and sized correctly, and that Brass should never forcefully change the position or size of the panel.
Note that when panel boundary checking is turned off, faulty code can cause the panel to be permanently displayed in an invisible (off screen or zero size) position. It is your responsibility to always validate any repositioning of the panel.
Important exception note: SETPANELBOUNDSCHECK only affects setpanelpos and setpanelsize statements. When a plugin is loaded Brass automatically reads the profile settings from the Registry, including the last position and size of the panel. As a safety measure Brass always performs a sanity check on these values, and if they are invalid (off screen or incorrectly sized) the panel position and size will be reset to its default state. This is a necessary safety measure as Registry corruption or a change in the display resolution can invalidate the profile position and size. Therefore if you wish to permanently force a position and size that would otherwise be considered by Brass to be invalid but is stored in the profile for use on the next plugin load, you should perform the following steps:
- Add a RegRead handler
- Store the position and size of the panel using getpanelxpos, getpanelypos, getpanelwidth, getpanelheight
- Add a PostRegRead handler
- Call SETPANELBOUNDSCHECK with a parameter of FALSE.
- Set the position and size of the panel using the stored values from step 2
This process succeeds because no sanity check is performed on the size and position of the panel when the profile is written on the last shutdown. When the RegRead handler is called the size and position values have already been read from the profile but no boundary checking has taken place. By storing the values then writing them back in the PostRegRead handler (which is called after the internal boundary check) you are able to bypass all sanity checks. This process is deliberately lengthy to prevent accidental use. Using this technique it's perfectly possible to create a situation where the panel is never visible on screen and the only way to fix it is to directly edit the Registry.
Parameters
EnableCheck
TRUE if Brass should perform all normal boundary checks, otherwise FALSE if the plugin will be responsible for boundary checking.
Return Value
None
Example Code
// The plugin is now responsible for boundary checking
setpanelboundscheck(False);
// Obviously off-screen but will still be accepted by Brass
setpanelpos(999999, 999999);