Suggested Enhancement to _touchstart

I discovered that if the user touches two buttons at the same time then releases them, one button will be ignored and left in a touched (depressed) display.

The simplest method I found to correct this situation is to add the following code after line 1270 in the touchui_debug.js file:

if (t._start_context && t._css_button_remove){
var target = t._start_context.target;
dhx.delay(function(){
var click_event = document.createEvent(‘MouseEvents’);
click_event.initEvent(‘click’, true, true);
target.dispatchEvent(click_event);
});
dhx.html.removeCss(t._css_button_remove,“dhx_touch”);
t._css_button_remove = null;
}

Looking at this code also raised the following question:
Is the usage of: target.dispatchEvent(click_event)
the same as: dhx.callEvent(“onClick”, [t._start_context]);
that is used in the _long_touch function?

Should the code be the same? If so, which one is the preferred method?

Thanks,
Kris

Problem confirmed, we will add some kind of solution to next version of lib.

nope,
target.dispatchEvent(click_event) - creates native dom event ( this code forces fast onclick reaction in mobile safari )
while dhx.callEvent(“onClick” - just send information signal for other dhtmlx components that click occurs ( this signal is used by popups, for example, which will hide self when click occurs )

this signal is used by popups, for example, which will hide self when click occurs

What is the best method of preventing a popup from hiding when the onClick is activated?

Thanks,
Kris

dhtmlxTouch provides two types of window like views

window - doesn’t react on clicks
popup - hides automatically on click

So the best solution - use “window” instead of popup, if you do not want to hide area after clicking . ( only clicking outside of popup area will cause such effect, click inside the popup will be ignored - in such case event received but ignored by popups)

What is the best method of preventing a popup from hiding when the onClick is activated?
Its hard to do without messing with popup internals

I tried the ‘window’ instead of popup and could not get the window to hide if clicking outside of the popup area. It appears that to hide a window by clicking the outsize of the window area is activated via an ‘onClick’ event. The ‘popup’ component has code that attaches to that event at line 9219. I could not find any similar code in ‘window’.

Is there something I am missing?

PS - I am still confused by a long button press activating the ‘onClick’ event when a typical button press activates the ‘click’ event. I would suggest that the two should be the same since the only difference is how long the user has pressed the button.

Thanks,
Kris

All clicks, long and fast result in dhx.callEvent("onClick in the end
The code which creates native click events is there for different use-cases.

Except of the original problem with two buttons pressing, do you have some other problem related to this piece of code.

… do you have some other problem related to this piece of code.

My use case is numeric pad entry. The popup is used to display a numeric pad so the user can entered numeric only entry fields. If the user activates the long touch event, the numeric pad will disappear. It is an activity that confused me when I first encountered it.

It would be nice to have some work around/option/method of suppressing the effect.

This is not a big issue. :slight_smile: I can develop a work around for my implementation. Just thought it might be something to consider. I like the design of the Touch library and find it easy to understand and work with. Thank you for all the hard work that was put into it.

Thanks,
Kris

If the user activates the long touch event, the numeric pad will disappear
We will investigate it, but you can try to use

{ view:“input”, type:“number”

or

{ view:“text”, type:“number”

Mobile browsers must show numeric keyboards for such kind of input