Haptic feedback? Visual feedback of a long touch?

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Jim Mac
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 54
Joined: Wed Jun 28, 2006 9:22 pm

Haptic feedback? Visual feedback of a long touch?

Post by Jim Mac » Sun Jan 01, 2023 8:11 pm

I have a situation where I'd like to use a long touch/hard touch to initiate editing a specific line of text in a field. Ideally, I'd like to have haptic feedback when the long touch has been registered, but I have no clue how to access that. Instead, I may process things in a "mouseStillDown" handler so that after the "long tough interval" I create a graphic of the targeted line and increase the size a bit so it looks like it's been selected and following the finger around a bit just for visual feedback.

My guess is this has been done many times before. Does anyone have any hints?

NOTE: In the back of my mind I think this might be easier with a datagrid or the like, but I've got working legacy code I'd like to glom onto rather than recode the entire thing.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9648
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Haptic feedback? Visual feedback of a long touch?

Post by dunbarx » Sun Jan 01, 2023 8:52 pm

Hi.

I assume this is for mobile. I don't do mobile.

But is something like this what you want, even though it may need to be adapted to a mobile touch? On a new card make a field and a button. In the button script:

Code: Select all

on mouseDown
   countDown the ticks
end mouseDown

on countDown startTicks
   repeat
      if the ticks - startTicks > 60 then
         put random (999) into fld 1
         exit to top
      end if
   end repeat
end countDown
The "60" is arbitrary, set to one second currently, and up to you.

Craig

Jim Mac
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 54
Joined: Wed Jun 28, 2006 9:22 pm

Re: Haptic feedback? Visual feedback of a long touch?

Post by Jim Mac » Sun Jan 01, 2023 9:17 pm

Thanks Craig,
Yes, this is on mobile.

I have the basic functionality operational with a dialog box popping up after touchend/mouseUp IF the touch has been held long enough but I don't like that there's no user feedback that they have "touched" long enough to trigger the edit function. I have a simple quick touch activating/deactivating items in the list... so knowing that you've held the tough long enough to enter "edit mode" would be good.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9648
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Haptic feedback? Visual feedback of a long touch?

Post by dunbarx » Sun Jan 01, 2023 9:28 pm

I figured you had gotten mainly as far as I posted.

But I still do not know what you are missing. Some sort of "active" display that the "touch" is "down"? I am using what I think are mobile terms, that well may make no sense at all.

A progress bar? A numerical countdown? What gadgetry gives the user the sense that something is properly developing, if only that user will continue pressing?

Craig

bwmilby
Posts: 438
Joined: Wed Jun 07, 2017 5:37 am
Location: Henrico, VA
Contact:

Re: Haptic feedback? Visual feedback of a long touch?

Post by bwmilby » Sun Jan 01, 2023 11:45 pm

Have you tried the

Code: Select all

mobileVibrate
command?
Brian Milby

Script Tracker https://github.com/bwmilby/scriptTracker

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

Re: Haptic feedback? Visual feedback of a long touch?

Post by SparkOut » Mon Jan 02, 2023 10:50 am

On Android, using a mobile browser to use this forum, I can long touch a word and when I lift my finger the word is selected, with draggable markers at each end to extend or change the selection. A popup also offers to copy the selection, do a search and offers other choices.
I am not sure what your interface does, but I guess most Android users will know how to make a selection this way without needing to be told the long touch threshold was reached 74 milliseconds ago. The threshold is quite low as it stands by default. It would be helpful to allow options for people to adjust the threshold, especially those with dexterity challenges, preferably to work with any accessibility settings that might have been adjusted for user preference.
As to iOS - I don't know, but there are pretty comprehensive guidelines about how Apple expects an app to behave in response to human action. I would definitely see what is expected before designing anything.

Jim Mac
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 54
Joined: Wed Jun 28, 2006 9:22 pm

Re: Haptic feedback? Visual feedback of a long touch?

Post by Jim Mac » Mon Jan 02, 2023 7:56 pm

Brian: I'll give that a try. Seems promising.

SparkOut: I was a bit unclear about what I need. The user has a list of words/phrases. Individual ones can be enabled/disabled with a touch. That list is used as the source for a randomly selected phrase to "load" a field on another screen. The locktext of the field is set so I can trap the single touch and figure out which entry I'm on without having the user be able to directly edit the field or have the keyboard appear.

Occasionally, the user will add an entry with a typo. The only way to deal with it now is to disable the phrase with the typo and re-enter it correctly. The old version stays around disabled... not a very polished behavior.

I'm looking to provide a way to edit entries by showing an edit box with the selected line. So, the long touch is to allow them to edit an existing entry but NOT in the field itself because lines matter.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9823
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Haptic feedback? Visual feedback of a long touch?

Post by FourthWorld » Mon Jan 02, 2023 10:42 pm

Jim Mac wrote:
Mon Jan 02, 2023 7:56 pm
Occasionally, the user will add an entry with a typo. The only way to deal with it now is to disable the phrase with the typo and re-enter it correctly. The old version stays around disabled... not a very polished behavior.

I'm looking to provide a way to edit entries by showing an edit box with the selected line. So, the long touch is to allow them to edit an existing entry but NOT in the field itself because lines matter.
Is there room for an Edit icon? Long-press is used many different ways, and the inconsistency is confounded by being a hidden feature, one without explicit guidance. If editing is anticipated it may be helpful to make that a visible feature.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply

Return to “iOS Deployment”