Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Disable rightclick after form.submit() in browser object
Message
De
20/04/2007 16:52:19
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
17/04/2007 14:59:32
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Applications Internet
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01216807
Message ID:
01218504
Vues:
20
This message has been marked as the solution to the initial question of the thread.
>>I have a html form which runs in a browser object on a form. This all works fine so far, but now there's an additional requirement to have a context menu as if it was a Fox form. I've hooked up the onclick() event of each of my input elements (tried with oncontextmenu() as well, to the same effect), like this - first, the JavaScript part:
>>
>>
function rclick(e)
>>{
>>if (event.button==2)
>>	{	var targ
>>		if (!e) var e = window.event
>>		if (e.target) targ = e.target
>>		else if (e.srcElement) targ = e.srcElement
>>		oFrm=document.forms[0];
>>		oFrm.action="rc:"+targ.name;
>>		oFrm.submit();
>>		return false;
>>	}
>>}
>>
>>and each control has something like this:
>>
>>
<INPUT onmouseup=rclick(event); class=FieldData id=_20Z0XI6JV
>>onchange=changed(this); name=_20Z0XI6JV>
>>
>>In oBrowser.beforenavigate2() I'm catching the rc: "protocol" and going through my code which should react on that - so far, so good. The code is only a messagebox, for now. Tried with a wait window, the same happens: after my code exits, the browser object's own context menu shows. Since my intent is to run my own context menu, this is obviously a bad GUI. In all the JS samples I could find, a "return false" is supposed to suppress the browser's context menu, but I guess the form.submit() somehow circumvents the code before it gets to "return false".
>
>I managed to get this to work using a stupid workaround:
>
>
keyboard "{ESC}" plain clear
>
>Tried to use some .obrowser.keypress or raiseevent() to the same effect, but couldn't find any such event in the browser object. Maybe there's some sort of wbexec() parameter that would allow keyboard driving it?

For any lurkers out there, who didn't stumble into this yet, here's the solution:

>>if (event.button==2)
>> { var targ
>> if (!e) var e = window.event
>> if (e.target) targ = e.target
>> else if (e.srcElement) targ = e.srcElement
e.returnValue=false;
>> oFrm=document.forms[0];
>> oFrm.action="rc:"+targ.name;
>> oFrm.submit();
>> return false;
>> }
>>}

The event.returnValue seems to exist in IE only - but then that's what I'm using.

Feels unnatural to star my own message, but it took me three days to find this - may save some time to someone else.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform