Jump to content

Recommended Posts

Posted

Hello..

 

i have a little problem:

 

TUniHTMLFrame.HTML.Append('...  onclick="ajaxRequest(....

TUniHTMLFrame.HTML.Append('...  ondblclick="ajaxRequest(.....
 
if i make a click - i get 1 ajax-event for onclick ..
if i make a doubleclick - 1 get 3 ajax-events.. 1x click 1x click 1x doubleclick ..
 
.. how can i handle it - to get 1 event for a doubleclick ?  .. any ideas?
 
ThanX
 

 

Posted
TUniHTMLFrame.HTML.Append('...  onclick="ajaxRequest(....

TUniHTMLFrame.HTML.Append('...  ondblclick="ajaxRequest(.....

 

 

Hi erich. 
 
Can you clarify? describe in more detail "ajaxRequest"? 
 
Best regards 
Posted

Hi,

 

the HTML Text of TUniHTMLFrame:

   strukturframe.HTML.Append('<p class=" strukturhoverpanel myUnselectable standardtext textpunkte"  ');
   strukturframe.HTML.Append('  onclick="ajaxRequest(data_struktur.steuerung,''Panelclick'' , ['''+unimainmodule.ZSTRUCTURE.fieldbyname('STRUCTURE_NR').AsString+''' , '''+unimainmodule.ZSTRUCTURE.fieldbyname('OBJECT_TYPE').AsString+''' ])"');
   strukturframe.HTML.Append('  ondblclick="ajaxRequest(data_struktur.steuerung,''Doppelclick'' , ['''+unimainmodule.ZSTRUCTURE.fieldbyname('STRUCTURE_NR').AsString+''' , '''+unimainmodule.ZSTRUCTURE.fieldbyname('OBJECT_TYPE').AsString+''' ])";>'+s+'');
....

The "data_struktur.steuerung" code

procedure Tdata_struktur.steuerungAjaxEvent(
  Sender: TComponent; EventName: string; Params: TStrings);
var a,b,c:String;
    i:Integer;
begin


UniServerModule.Logger.AddLog('2.Ajax-Event:'+EventName);


if EventName ='Panelclick'  then  einfacherklick(strtoint((Params[4])));
if EventName ='Doppelclick' then  doppelklick(strtoint((Params[4])));

... i want to start 2 different delphi procedures ... if normal click then start procedure "einfachklick" .. and if doubleclick then start "doppelklick"

 

 

ThanX for suggestions 

Erich

 

 

 

 

Posted

Hi erich.

 

On one element you need to use or click or dbclick, but not both.

 

Or use this method:

 

try...

<a id="press" href="javascript:void(0)" onclick="singleClick(event)"
ondblclick="doubleClick(event)">Click here</a>
<div id="log"></div>

var timer;
var status = 1;

function singleClick(event) {

event.preventDefault();
status = 1;
timer = setTimeout(function() {
if (status == 1) {
alert("I am single click !");
document.getElementById("log").innerHTML ='I am single click !';
}
}, 500);

}

function doubleClick(event) {

event.preventDefault();
clearTimeout(timer);
status = 0;
alert("I am double click !");
document.getElementById("log").innerHTML = 'I am a double click!';
}

or

//jquery
$('#press').click(function (event) {
event.preventDefault();

if ( $(this).data('dblclicked') ) {
$('#log').text('No google today!');
clearTimeout( $(this).data('clicked') );
$(this).data('dblclicked', false);
}else{
var self = this;
$(this).data('dblclicked', true).data('clicked', setTimeout(function() {
$('#log').text('google !');
$(self).data('dblclicked', false);
},300));
}
});

http://stackoverflow.com/questions/17921556/double-click-ambiguity-in-jquery

 

 

Best regards.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...