>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?