- This topic has 3 replies, 2 voices, and was last updated 10 years, 2 months ago by mobio9471.
-
AuthorPosts
-
mobio9471MemberHi,
working on creating a list using MobioneListBuilder.js I encountered some problems with touch/mouse events.
If I touch an element of the list shortly, a funtion “funcShort(){ …}” should be called to perform some element related functionality.
If I do long touch a function “funcLong(){ …}” should be called to bring up a popup menu.To accomplish this I modified MobioneListBuilder.js by adding a “onclick” event to each element of the list.
code:
if (index == resultSet.length-1) {
newListItem.addClass(cssPrefix + ‘last’);
}
// — above is original code and I added the code below
newListItem.attr(“onclick”,”funcShort(“+index+”)”);This works fine in simulator and on Samsung S2 Android 2.3.3 and Samsung S3 Android 4.0.4
Because I found no hint how to realize a long touch event I tried to build double click events from html5 mouse events “ondblclick”, “onmousedown”, “onmouseup” like this
newListItem.attr(“onclick”,”funcClick(“+index+”)”);
newListItem.attr(“ondblclick”,”funcDblClick(“+index+”)”);
and additionaly use setTimeout() to call funcShort() and funcLong() respectively.and alternatively
newListItem.attr(“onmousewdown”,”funcMouseDown(“+index+”)”);
newListItem.attr(“onmouseup”,”funcMouseUp(“+index+”)”);
and additionaly use setTimeout() to call funcShort() and funcLong() respectively.Both approaches work perfectly on the simulator but “ondblclick”, “onmousedown”, “onmouseup” do not at all work on
Samsung S2 Android 2.3.3 and Samsung S3 Android 4.0.4
Did I something wrong ?
How can a long touch solution accomplished ?
Does something like a dedicated “longtouch” event exist.Any help is very appreciated !
mobio9471MemberHi mobione team,
is something wrong with my question ?
Why don’t I get any reply ?
Please let me know.
My intension is to create a popup menue in response to a long touch to a list element.
Meanwhile I realized a double click using a ‘onclick’ event and a setTimeout() function.
That means if I single touch/click the list element a functionClick() is invoked.
If I click the list element twice in a time period I get the popup menue instead.
But I still would prefer to get the popup menue in response to a long touch to the list element instead of a double touch/click.
Any help/reply would be very appreciated !
support-michaelKeymasterNotice that mobione is automatically attaching event handlers to every component during startup. I think you custom handlers are conflicting with those assign by mobione’s phoneui.js lib. If you look at some of the list examples they basically use the 1st item in a list as a template and replicate it. The framework is kind of rigid for customized interaction. I’ll try to dig into this a little deeper over the next few days (the main dev on event handlers is on a european vacation for a few more weeks.) Also fire up the Simulator (chrome) dev tools to dig in deeper and assess exactly what’s going on with your code at runtime (f12 or right-click menu>inspect).
mobio9471MemberThank you very much for your reply michael,
I will have a closer look to the examples.
-
AuthorPosts