Page 1 of 1

Tooltip

Posted: Tue Feb 01, 2022 11:19 pm
by Samuele
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 6835 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!

Re: Tooltip

Posted: Wed Feb 02, 2022 9:34 am
by richmond62
Cannot an android native field have a tooltip
of its own?
-
Scrivi.png
Scrivi.png (8.62 KiB) Viewed 6788 times
-
Never looked at android native fields before:

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

Re: Tooltip

Posted: Wed Feb 02, 2022 12:30 pm
by Samuele
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.

Re: Tooltip

Posted: Wed Feb 02, 2022 12:35 pm
by richmond62
on mobile there ain't no tooltips
Then why are TOOLTIPS offered in the Android native field?

Re: Tooltip

Posted: Wed Feb 02, 2022 12:40 pm
by Klaus
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...

Re: Tooltip

Posted: Wed Feb 02, 2022 4:47 pm
by mrcoollion
Maybe use a longpress on the button to show a message box ?
viewtopic.php?t=29699

Paul

Re: Tooltip

Posted: Wed Feb 02, 2022 5:47 pm
by SWEdeAndy
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...

Re: Tooltip

Posted: Wed Feb 02, 2022 5:47 pm
by andresdt
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

Re: Tooltip

Posted: Wed Feb 02, 2022 5:55 pm
by richmond62
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.

Re: Tooltip

Posted: Wed Feb 02, 2022 6:25 pm
by jacque
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.

Re: Tooltip

Posted: Thu Feb 03, 2022 12:28 pm
by Samuele
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?

Re: Tooltip

Posted: Thu Feb 03, 2022 9:15 pm
by jacque
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.

Re: Tooltip

Posted: Thu Feb 03, 2022 9:26 pm
by Samuele
:roll: ahhh...