Skip to content

Latest commit

 

History

History
58 lines (49 loc) · 3.9 KB

README.md

File metadata and controls

58 lines (49 loc) · 3.9 KB

DisclosureWidget (a.k.a. Expand/Collapse buttons)

This project contains XControls that provide basic "Disclosure Widget" functionality: buttons that can dynamically expand and collapse the containing front panel by a set number of pixels.

There are two separate XControls: one for horizontal expand/collapse behavior, and one for vertical.

Features / Usage

  • Demos:

    • Initial setup
      Hey, this is a DisclosureWidget, too!
    • Expanding along both axes
      Hey, this is a DisclosureWidget, too!
    • Dynamic resizing/tweaking

      You can see the size adjust dynamically as you tweak the value in the prompt, so you can really dial it in!

      Note that this relies on Value Change events, so you need to leave keyfocus or leverage the up/down arrows to trigger the resizing. Try using up/down arrows at different digits in the value to change the magnitude of adjustments!


  • Right-click on an instance of either xcontrol to specify the number of pixels to expand the front panel.

    • Expansion is relative to the xcontrol itself, specifically the bottom of the xcontrol for the vertical item, and the right side of the control for the horizontal.
    • The specified value is applied as the "Size" property, which is maintained in the local state of the xcontrol.
      • This property will persist across unload of the VI from memory, provided that you save it after making the change
  • Notice that there is no code needed on the block diagram?

  • By using xcontrols, the expand/collapse operations are supported in both runtime and edit mode.

    • This makes it easy to adjust the expanded size during development.

    • Note: the xcontrols ignore right-clicks at runtime, but you may reach the "Size" shortcut menu option at runtime by CTRL+right-clicking on it.

    • Rationale: the expectation is that configuration will be done at edit-time, and we probably don't want to expose the "Size" menu option to end-users at runtime. But it can be a valuable debug tool, so it is "hidden" (security through obscurity!) behind a CTRL+click interaction to make it less likely that a user will stumble upon it.

Caveats / Known Issues

  • These xcontrols don't play nicely with multi-pane front panels, or within subpanels.
  • The xcontrol will attempt an intial resize when the owning VI is first loaded; this is typically desired, but could be surprising if unexpected.
  • It is advised that you configure the "Size" property and save calling VIs in the desired state such that there is no immediate resizing on VI load.
  • The xcontrols do not currently support setting the default value (always initialize collapsed)
  • Repositioning the xcontrol does not immediately autosize.
    • You will need to toggle the button to re-adjust the size after you move the control.
  • This is an xcontrol, so all the usual caveats apply:
    • Troubleshooting is a bit cumbersome, but you can right click and select Advanced > Show Diagram to view/probe the block diagrame of the facade.
    • All the xcontrol library files will be reserved as long as there are an VIs in memory with an instance of the xcontrol on its front panel.
    • See also: debugging xcontrols