Welcome Guest (Log in)

SkPopover

General
Expander triangle
  • Author
  • Rating
  • Type
  • Revision
  • Downloaded
  • Updated
  • Stam Kapetanakis
  • StarStarStarStarStar
  • Stack
  • 3
  • 143 Times
  • 20 October 2021
A popover control
Version 0.94 changes:

- redesigned the plugin for much narrower layout, using my 'skRadial' radial sliders (also posted on sample stacks/liveCodeShare, search for skRadial)

- popover functions moved to a behaviour script (invisible button inside the popover) to free up the popover's script for user defined functions (with the exception of 2 short handlers that ensure that the behaviour script is assigned on openControl and on resizeControl - required as the id of the button changes on copy/pasting).

- changed the way existing skPopovers can be edited.
The 'red gears' graphic has been removed as that way of launching the plugin for editing as it was causing too many issues.
Instead, select the skPopover to be edited, and click the "Edit popover" button.
If the selected object is not an skPopover or if no object is selected, it will instead set up the skPopover prototype in the plugin for editing.

- new custom property isSkPopover is set to true; this means you can iterate through controls assessing this instead of names, for example to hide all popovers.

For example, to hide all popovers (eg when user clicks outside it:
on mouseDown
repeat with x = 1 to the number of groups of this card
if the isSkPopover of group x of this card then hide group x of this card
end repeat
end mouseDown

- setPositionForArrowAt pX, pY : a new easier way to position the skPopover so the apex of the arrow is located at the passed coordinates, no matter where along the side of the popover the arrow is - useful when dynamically moving the arrow (eg when otherwise the popover would be clipped by the boundary of the card) - just reposition the arrow and call this handler to position the skPopover at the corrrect location.


API
# Custom properties:
- uSide : the side on which the arrow appears (left/top/right/bottom)
- uPercentageOfLength : the percentage of the side selected where the middle of the 'arrow' will appear
- uScaleFactor : the percentage of the side that will form the base of the arrow
- uLineSize : line size for visible elements
- uCornerRadius : corner radius of the popover box
- isSkPopover - boolean declaring thie group as an skPopover (new as of 0.94)

# Handlers
- setSide pSide : select a side of the popover to display hte arrow
- setLocation pPercentageOfLength : position the middle of the arrow at the passed percentage of length of uSide
- scaleArrow pScaleFactor : scale the width of the arrow as percentage of uside
- setCornerRadius pRadius : adjust the corner radius
- setLineSize pSize : self explanatory
- setLineColor pColor : self explanatory
- setFillColor pColor : self explanatory
- setPositionForArrowAt pX, pY : positions the skPopover so the apex of the arrow is located at the passed coordinates (new as of 0.94)


--------------------------------
Use as plugin - drop into plugins folder and restart the IDE

Set up in the plugin and then copy to topstack, or copy to topstack and then modify in plugin by hovering over the gears icon, that only appears in edit mode (pointer tool selected) - this activates the plugin to edit the chosen popover at any time.

To add controls to the popover, 'edit group' and any controls you like.
Be aware that to resize the popover you must not be editing the popoover group and must not have 'select grouped' activated.

Work in progress, any issues let me know...
Ajax Loader
Tags
Expander triangle
User Comments
Expander triangle