This might be useful for some (New AGAIN)

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: This might be useful for some (New AGAIN)

Post by bogs » Tue Apr 27, 2021 11:32 pm

Clicking this...
Image

will give you this....
Image
Image

stam
Posts: 2599
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: This might be useful for some (New AGAIN)

Post by stam » Wed Apr 28, 2021 7:44 am

marksmithhfx wrote:
Tue Apr 27, 2021 11:24 pm
. I did run into one error when hovering over the gears. The version I downloaded from livecodeshare had a .rev extension, but the code is looking for a file with a .livecode extension.
https://postimg.cc/YjhzWjtq
Thanks Mark,

Shouldn’t be a .Rev file - all my files are .liveCode... not sure why that changed. Also can’t really remember why it’s looking for a file type! (Haven’t looked at some the code in a while ;))

There is an issue with the gears: if you’re editing the group and hover over it, it WILL generate an error - I’m not sure what message I could trap to change this... if anyone is aware of that message I could use when starting to edit group that would help fix this!

(holding down the shift key will ignore the gears, maybe I should reverse that - but this was borne out of my laziness so I think I prefer the immediacy)

Will see if I can address these issues (and work on changing length of arrow) when possible...

Stam

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 931
Joined: Thu Nov 13, 2008 6:48 am
Location: London, UK

Re: This might be useful for some (New AGAIN)

Post by marksmithhfx » Wed Apr 28, 2021 4:16 pm

stam wrote:
Wed Apr 28, 2021 7:44 am
Shouldn’t be a .Rev file - all my files are .liveCode... not sure why that changed. Also can’t really remember why it’s looking for a file type! (Haven’t looked at some the code in a while ;))
Have a look at the image I just posted with the extension in my dloads folder after using the download button on Livecodeshare. I changed it to .livecode and the gear errors I was having disappeared. Your tool is very useful, and very functional. For myself, I don't expect something in this "helper class" to be completely polished. If it gets the job done...

Now we have a choice 😊

See my next message when I post a side-by-side comparison of "guidance" dialogs created by yours and Michaels tool. I am just grateful they both exist.

Mark

https://postimg.cc/ykWpdT8f
Last edited by marksmithhfx on Thu Jul 15, 2021 9:58 pm, edited 1 time in total.
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 931
Joined: Thu Nov 13, 2008 6:48 am
Location: London, UK

Re: This might be useful for some (New AGAIN)

Post by marksmithhfx » Wed Apr 28, 2021 4:21 pm

Side by side comparing skpopover and Fair and Square...

They both get the job done but in different ways. Thanks guys!

Mark

https://postimg.cc/n9rnLwrF
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 931
Joined: Thu Nov 13, 2008 6:48 am
Location: London, UK

Re: This might be useful for some (New AGAIN)

Post by marksmithhfx » Wed Apr 28, 2021 4:22 pm

bogs wrote:
Tue Apr 27, 2021 11:32 pm
Clicking this...
Image

will give you this....
Image
Thanks Bogs!!!
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: This might be useful for some (New AGAIN)

Post by bogs » Wed Apr 28, 2021 5:14 pm

No problems :)
Image

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: This might be useful for some (New AGAIN)

Post by mwieder » Sat Jul 03, 2021 4:33 am

(catching up on some older reading here...)

Stam-

Finally looking at your skPopover plugin. Nicely done.

The skPopover stack on livecodeShare has a .rev extension instead of .livecode.
After changing the file extension in my plugins path I still threw an error hovering over the red gears icon.
The problem is the hard-coded address when you're starting to use the plugin stack.
Changing

Code: Select all

   --start using stack (specialFolderPath("documents") & "/My LiveCode/plugins/skPopover.livecode")
to

Code: Select all

   start using stack (revEnvironmentUserPluginsPath() & "/skPopover.livecode")
fixes the problem.

Also, the red gears icon doesn't appear at first, even though I'm in pointer mode. It's only when switching from browse mode to pointer mode that it appears. Initializing the icon on starting the plugin depending on the current tool would fix this:

Code: Select all

on openControl
   if the environment is "development" then
      revIDESubscribe "ideToolChanged"
   end if
   ideToolChanged
end openControl

stam
Posts: 2599
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: This might be useful for some (New AGAIN)

Post by stam » Sat Jul 03, 2021 5:54 pm

mwieder wrote:
Sat Jul 03, 2021 4:33 am
...

Code: Select all

   start using stack (revEnvironmentUserPluginsPath() & "/skPopover.livecode")
fixes the problem.
...
Initializing the icon on starting the plugin depending on the current tool would fix this:

Code: Select all

on openControl
   if the environment is "development" then
      revIDESubscribe "ideToolChanged"
   end if
   ideToolChanged
end openControl
Thank you for the tips @mwieder! I'll implement and upload a new version when possible (right now bogged down between my IRL non-coding work and coding projects that are long overdue for said work... but will implement these changes along with some others that have been bothering me with the plugin...

Thank you once again!
Stam

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: This might be useful for some (New AGAIN)

Post by mwieder » Sat Jul 03, 2021 6:42 pm

Oooo... looking forward to a new version. 8)

stam
Posts: 2599
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: This might be useful for some (New AGAIN)

Post by stam » Thu Oct 21, 2021 2:29 am

mwieder wrote:
Sat Jul 03, 2021 6:42 pm
Oooo... looking forward to a new version. 8)
I've redesigned this and uploaded to liveCodeShare: http://livecodeshare.runrev.com/stack/990/SkPopover

As always, while i use this for my own purposes i share freely in case others find this helpful - any feedback welcome.

skPopover 0.94.jpg


Version 0.94 changes:
- redesigned the plugin for much narrower layout, using my radial slider skRadial

- skPopover handlers 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 was causing too many issues. Instead, select the skPopover to be edited, and click the "Edit popover" button in the plugin. Any changes made will be shown both in the selected control and in the prototype skPopover in the plugin.
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 boolean, which identifies the group as an skPopover; this means you can iterate through controls assessing this instead of the group name, for example when hiding all popovers.

For example, to hide all popovers (eg when user clicks outside it) this can be in the card script:

Code: Select all

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 for ensuring the skPopover is always at the correct location when making it visible, but especially helpful 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 : self explanatory
- 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)

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: This might be useful for some (New AGAIN)

Post by mwieder » Sat Oct 23, 2021 2:50 am

Nice. Added to my plugins folder now.
Made a couple of changes though:

Button "skPopoverBehavior" still has a bnGuides button as its behavior script. Obviously a relic of some object placement - its lack is mostly harmless, but it shows up as a red flag in the Project Browser, so I deleted the behavior.

I unchecked the selectGroupedControls checkbox for the prototypePopover group. This makes it possible to move the popover once it's been copied to the topstack. Did the same for group "skRadial" in stack "skRadial"

stam
Posts: 2599
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: This might be useful for some (New AGAIN)

Post by stam » Sat Oct 23, 2021 9:47 am

mwieder wrote:
Sat Oct 23, 2021 2:50 am
Nice. Added to my plugins folder now.
Made a couple of changes though:

Button "skPopoverBehavior" still has a bnGuides button as its behavior script. Obviously a relic of some object placement - its lack is mostly harmless, but it shows up as a red flag in the Project Browser, so I deleted the behavior.

I unchecked the selectGroupedControls checkbox for the prototypePopover group. This makes it possible to move the popover once it's been copied to the topstack. Did the same for group "skRadial" in stack "skRadial"
Thanks @mwieder - that bnGuides thing was probably an accidental leftover/bug from Bernd’s bnGuides plug-in. Certainly not intended. But in the other hand, since the button is invisible and serves only to store the behaviour script is of no consequence - but will make sure it’s removed!

Didn’t realise the selectGroupedControls setting was stored (it isn’t in mine) - but thanks for picking these points up, will correct and upload a new version.

I can also post a simple stack with some examples of how to use (eg how to dynamically set the arrow, how to position automatically for example to point at a row in a data grid etc) if that would be helpful…

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 931
Joined: Thu Nov 13, 2008 6:48 am
Location: London, UK

Re: This might be useful for some (New AGAIN)

Post by marksmithhfx » Sat Oct 23, 2021 5:44 pm

stam wrote:
Sat Oct 23, 2021 9:47 am
I can also post a simple stack with some examples of how to use (eg how to dynamically set the arrow, how to position automatically for example to point at a row in a data grid etc) if that would be helpful…
Stam, if you get round to it I'd be interested in trying it out.

Best,
Mark
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

stam
Posts: 2599
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: This might be useful for some (New AGAIN)

Post by stam » Mon Oct 25, 2021 12:32 am

marksmithhfx wrote:
Sat Oct 23, 2021 5:44 pm
Stam, if you get round to it I'd be interested in trying it out.

Best,
Mark
Hi Mark, i had some time spare (well, more like i was trying to avoid other work ;) )

Here's a small stack (4 cards) with some tips and the last card includes my standard script for triggering the popover from a data grid and dynamically moving the arrow so it doesn't get clipped by the window (note that this script lives in a mouseDown handler in the behaviour for the data grid form).

Hope that helps, but let me know if something doesn't make sense.
Stam

skPopoverTutorial.jpg
Attachments
skPopover tutorial.livecode.zip
(23.09 KiB) Downloaded 105 times

stam
Posts: 2599
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: This might be useful for some (New AGAIN)

Post by stam » Mon Oct 25, 2021 8:26 pm

Just FYI - in card 2 i forgot to catch the 'mouseDown' message in the 'toggle' button.
Just add an empty mouseDown handler in the button's script and it will toggle (because i later added a handler to the card to hide popovers, it seems clicking on the button triggers the card's mouseDown unless caught in the button).

Post Reply

Return to “Talking LiveCode”