Tooltip

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm
Location: Italy

Tooltip

Post by Samuele » Tue Feb 01, 2022 11:19 pm

Hi, i'm trying to put a label field on top of an android native field to create this sort of tooltip effect
Immagine 2022-02-01 231222.png
Immagine 2022-02-01 231222.png (4.95 KiB) Viewed 5130 times
but on mobile the field that i put on top (the "tooltip") is not shown or can't be seen amd only the "editable" field is shown.
Any ideas on how make it work? Thanks!
Samuele.

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

Re: Tooltip

Post by richmond62 » Wed Feb 02, 2022 9:34 am

Cannot an android native field have a tooltip
of its own?
-
Scrivi.png
Scrivi.png (8.62 KiB) Viewed 5083 times
-
Never looked at android native fields before:

Samuele; you need to drink more coffee. 8)
-
Scrivi2.png

Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm
Location: Italy

Re: Tooltip

Post by Samuele » Wed Feb 02, 2022 12:30 pm

richmond62 wrote:
Wed Feb 02, 2022 9:34 am
Samuele; you need to drink more coffee.
I think i drink too much of it :D
No but as usual you shouldn't take my words precisely, i forgot to write that i didn't mean tooltip literally, because i want it for mobile and on mobile there ain't no tooltips, so I'm trying to create a similar thing to a tooltip but for mobile as i showed in the attachment.
Samuele.

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

Re: Tooltip

Post by richmond62 » Wed Feb 02, 2022 12:35 pm

on mobile there ain't no tooltips
Then why are TOOLTIPS offered in the Android native field?

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

Re: Tooltip

Post by Klaus » Wed Feb 02, 2022 12:40 pm

Yes, no tooltips on the mobile platform -> no cursor = no tooltip

And since all "native" controls, like the Android native field, are shown as an OVERLAY
in your runtime, means they float above everything and therefore we cannot even fake a
tooltip with an ordinary LC field object. This will always disappear behind the native control.

Sorry for the bad news...

mrcoollion
Posts: 722
Joined: Thu Sep 11, 2014 1:49 pm
Location: The Netherlands

Re: Tooltip

Post by mrcoollion » Wed Feb 02, 2022 4:47 pm

Maybe use a longpress on the button to show a message box ?
viewtopic.php?t=29699

Paul

SWEdeAndy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 270
Joined: Sat Aug 16, 2008 9:48 am
Location: Stockholm, Sweden
Contact:

Re: Tooltip

Post by SWEdeAndy » Wed Feb 02, 2022 5:47 pm

Maybe this could work:

In the card script:

Code: Select all

command setMyTooltip pID,pText
   set the text of pID to pText
   if pText is empty then set the fieldTextColor of pID to black ## The user can type something
   else set the fieldTextColor of pID to grey ## Or the RGB code of the colour you prefer for the tooltip
end setMyTooltip
Then in the widget's script:

Code: Select all

on openField
   setMyTooltip the long id of me,empty ## This clears the tooltip text and sets normal text colour
end openField

on exitField
   setMyTooltip the long id of me,"Scrivi un messagio" ## This restores the tooltip if the user didn't enter anything 
end exitField
This is untested, but you can experiment with this general idea...
Andreas Bergendal
Independent app and system developer
Free LC dev tools: https://github.com/wheninspace
WhenInSpace: https://wheninspace.se/en

andresdt
Posts: 147
Joined: Fri Aug 16, 2019 7:51 pm

Re: Tooltip

Post by andresdt » Wed Feb 02, 2022 5:47 pm

hi @Samuel, maybe what you are looking for is a "placeholder". If this is what you need you might want to check out the lesson https://lessons.livecode.com/m/4071/l/6 ... -behaviors

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

Re: Tooltip

Post by richmond62 » Wed Feb 02, 2022 5:55 pm

the Android native field, are shown as an OVERLAY
in your runtime, means they float above everything
So, MAYBE a trick worth trying is to have a 'tooltip' in a second Android native field.

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

Re: Tooltip

Post by jacque » Wed Feb 02, 2022 6:25 pm

Long-pressing a button is the standard interface for showing a tooltip, so that's a good idea. But as Klaus said, LC's implementation doesn't allow other controls to be layered over the native one, so you need to work around that limitation.

You could place the explanatory field outside the bounds of the native field where it would show. Alternately, use the toast widget to show a brief description. An advantage to using the toast is that it automatically dismisses itself, so using it is a one-line call.

Finally, I believe native controls can be layered amongst themselves, so you could create a native input field to display the text which would allow you to place it anywhere.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm
Location: Italy

Re: Tooltip

Post by Samuele » Thu Feb 03, 2022 12:28 pm

alright, i tried to put this script on an android native button

Code: Select all

on mouseDown
   hide me
end mouseDown
but it doesn't work (obviously i tried on mobile) does the android native button have different handlers for mouseDown or for hide?
Samuele.

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

Re: Tooltip

Post by jacque » Thu Feb 03, 2022 9:15 pm

Good question, there is no documentation about which commands the native button will respond to. I've never used that widget, but I have to assume it would honor mouseDown and mouseUp, so I'm surprised it didn't work for you. However, my suggestion won't work with widgets, if you want to layer native controls you have to script them with mobileControlCreate.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm
Location: Italy

Re: Tooltip

Post by Samuele » Thu Feb 03, 2022 9:26 pm

:roll: ahhh...
Samuele.

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”