Page 3 of 5
Re: Tool tips
Posted: Sun May 31, 2020 1:19 pm
by SparkOut
Er, you know about the built-in functions globalLoc and localLoc don't you Richmond?
Re: Tool tips
Posted: Sun May 31, 2020 3:04 pm
by richmond62
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.
Re: Tool tips
Posted: Sun May 31, 2020 5:30 pm
by jacque
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.
Re: Tool tips
Posted: Sun May 31, 2020 5:41 pm
by richmond62
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.
Re: Tool tips
Posted: Sun May 31, 2020 5:49 pm
by richmond62
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
Re: Tool tips
Posted: Sun May 31, 2020 5:59 pm
by richmond62
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.
Re: Tool tips
Posted: Sun May 31, 2020 6:04 pm
by Klaus
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.
Re: Tool tips
Posted: Sun May 31, 2020 6:13 pm
by jacque
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.
Re: Tool tips
Posted: Sun May 31, 2020 6:15 pm
by richmond62
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
-
Re: Tool tips
Posted: Sun May 31, 2020 6:19 pm
by richmond62
I can't recall offhand if standalones will draw outside the stack rect.
-
-
Standalones do draw outside the stack rect (on Macintosh, at least).
Re: Tool tips
Posted: Sun May 31, 2020 6:21 pm
by richmond62
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?
Re: Tool tips
Posted: Sun May 31, 2020 6:23 pm
by Klaus
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

Re: Tool tips
Posted: Sun May 31, 2020 6:24 pm
by Klaus
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!
Re: Tool tips
Posted: Sun May 31, 2020 6:25 pm
by richmond62
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.

Re: Tool tips
Posted: Sun May 31, 2020 6:26 pm
by richmond62
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.
