Tool tips

Want to talk about something that isn't covered by another category?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

SparkOut
Posts: 2852
Joined: Sun Sep 23, 2007 4:58 pm

Re: Tool tips

Post by SparkOut » Sun May 31, 2020 1:19 pm

Er, you know about the built-in functions globalLoc and localLoc don't you Richmond?

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9383
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Tool tips

Post by richmond62 » Sun May 31, 2020 3:04 pm

No, I don't. :?

Frankly I wonder why globalLoc would occur to me.

If you look up location in the dictionary globalLoc is not mentioned.

And that is my main criticism of LiveCode:

To a very large extent it is difficult to know what to look for in the Documentation unless you already know it.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7230
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Tool tips

Post by jacque » Sun May 31, 2020 5:30 pm

A couple of things. The custom property I mentioned that stores the tooltip is instead of the built-in one; if you use both then you have deal with LC popping up its own. The LC tooltip should be empty, you will handle the display in script. No need to mess around with the stack visibility, which is distracting.

The location of the field should probably remain on the card. I would get the mouseloc, subtract the height of the tooltip field plus a little more from item 2 of it, and set the field there. If you're feeling adventurous, calculate whether that adjustment will run off the top of the card and if so, add the amount to item 2 of the mouseloc instead so it appears below the object.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9383
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Tool tips

Post by richmond62 » Sun May 31, 2020 5:41 pm

To pick a few holes in globalLoc for this sort of exercise
where I want the topLeft of my palette to be set to the bottomRight of the object,
using globalLoc would still involve as many calculations as in my effort,
as to find the bottomLeft of the object would involve
adding half of the width of the object and half of the height to the object's globalLoc.

While I would not deny that globalLoc may be useful elsewhere, in this context it is
neither worse or better than my method.

HOWEVER . . . it would be very useful if, in the Documentation, on looking up location
it cross-referenced globalLoc.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9383
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Tool tips

Post by richmond62 » Sun May 31, 2020 5:49 pm

The other thing about my method is that one has to have 'that' mouseEnter . . . mouseLeave code
in the script of every object, which is extremely clunky seeing it is always the same.

I wonder if this sort of thing can not be be universally applied . . .

Err . . . pseudoCode in the stackScript:

on objectEnter
do what-have-ye
end objectEnter

on objectLeave
do sumpin else
end objectLeave

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9383
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Tool tips

Post by richmond62 » Sun May 31, 2020 5:59 pm

The location of the field should probably remain on the card.
Why?

By having the field in a floating palette it guarantees the original tooltips don't show,
and that the field is not cut off by the left, right or bottom of the stack without the need
to perform extra calculations to accommodate a field inwith the bounds of a stack.

I do agree, however, that the field (and by necessity) the palettised stack, should resize according to the size of the tooltip.

Klaus
Posts: 13828
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Tool tips

Post by Klaus » Sun May 31, 2020 6:04 pm

jacque wrote:
Sun May 31, 2020 5:30 pm
A couple of things. The custom property I mentioned that stores the tooltip is instead of the built-in one; if you use both then you have deal with LC popping up its own. The LC tooltip should be empty, you will handle the display in script.
We can supress the display of tooltips in LC at all by simply setting the global property tooltipdelay to 0

Code: Select all

on openstack
  set the tooltipdelay to 0
end openstack
This way we can keep existing tooltips.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7230
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Tool tips

Post by jacque » Sun May 31, 2020 6:13 pm

Oh right, I forgot about tooltip suppression. Thanks.

Richmond, the reason to keep the field on the card is to allow it to work on mobile devices, and possibly on standalones - - I can't recall offhand if standalones will draw outside the stack rect.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9383
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Tool tips

Post by richmond62 » Sun May 31, 2020 6:15 pm

Code: Select all

on mouseEnter
   if the toolTip of me is empty then
      -- do nix
   else
      set the text of fld "tipper" of stack "TopTips" to the toolTip of me
      put the bottomRight of me into BR
      put item 1 of the loc of this stack into SLR
      put item 2 of the loc of this stack into SUD
      put (the width of this stack)/2 into SL
      put (the height of this stack)/2 into SH
      put (SLR - SL) into LEDGE
      put (SUD - SH) into TEDGE
      put (LEDGE + (the right of me)) into RSIDE
      put (TEDGE + (the bottom of me)) into OBBUM
      ---
      put the formattedWidth of fld "tipper" of stack "TopTips" into NWIDD
      put the formattedHeight of fld "tipper" of stack "TopTips" into NHITE
      set the width of fld "tipper" of stack "TopTips" to NWIDD
      set the height  of fld "tipper" of stack "TopTips" to NHITE
      set the width of stack "TopTips" to (NWIDD + 4)
      set the height of stack "TopTips" to (NHITE + 4)
      set the top of fld "tipper" of stack "TopTips" to 2
      set the left of fld "tipper" of stack "TopTips" to 2
      ---
      set the topLeft of stack "TopTips" to (RSIDE, OBBUM)
      set the vis of stack "TopTips" to true
   end if
end mouseEnter

on mouseLeave
   set the vis of stack "TopTips" to false
end mouseLeave
-
SizedFields.jpg
Attachments
Clootie 6.livecode.zip
Going off the deep end.
(45.24 KiB) Downloaded 192 times

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9383
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Tool tips

Post by richmond62 » Sun May 31, 2020 6:19 pm

I can't recall offhand if standalones will draw outside the stack rect.
-
standalone.jpg
-
Standalones do draw outside the stack rect (on Macintosh, at least).

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9383
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Tool tips

Post by richmond62 » Sun May 31, 2020 6:21 pm

the reason to keep the field on the card is to allow it to work on mobile devices
Can a mobile standalone not have substacks?

Klaus
Posts: 13828
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Tool tips

Post by Klaus » Sun May 31, 2020 6:23 pm

Code: Select all

on mouseEnter
   if the toolTip of me is empty then
      -- do nix
   else
...
Never understood this way of scripting, why use else if not neccessary at all?
I, personally try to avoid any nested IF THEN ELSE if possible:

Code: Select all

on mouseEnter
   if the toolTip of me <> empty then
      set the text of fld "tipper" of stack "TopTips" to the toolTip of me
      put the bottomRight of me into BR
    ...
  end if
end mouseenter
Or even better:

Code: Select all

on mouseEnter
   if the toolTip of me = empty then
     exit to top
   end if
   set the text of fld "tipper" of stack "TopTips" to the toolTip of me
   put the bottomRight of me into BR
  ...
end mouseenter

:D

Klaus
Posts: 13828
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Tool tips

Post by Klaus » Sun May 31, 2020 6:24 pm

richmond62 wrote:
Sun May 31, 2020 6:21 pm
the reason to keep the field on the card is to allow it to work on mobile devices
Can a mobile standalone not have substacks?
It can, but we only can have ONE stack open at a time on mobile!

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9383
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Tool tips

Post by richmond62 » Sun May 31, 2020 6:25 pm

Klaus . . . I know that what I have done contains "shaggy code" . . .
but, frankly, I don't care that much as, having got the thing working I can tidy up the code subsequently. :D

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9383
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Tool tips

Post by richmond62 » Sun May 31, 2020 6:26 pm

Klaus wrote:
Sun May 31, 2020 6:24 pm
richmond62 wrote:
Sun May 31, 2020 6:21 pm
the reason to keep the field on the card is to allow it to work on mobile devices
Can a mobile standalone not have substacks?
It can, but we only can have ONE stack open at a time on mobile!
Fegs. :(

Post Reply

Return to “Off-Topic”