Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 6 of 6 total
Thread Adding to the body tag
Tue, Jul 2 2013 8:16 AMPermanent Link

Matthew Jones

I want to disable the context menu for my application, to stop "print" and "view
source" etc. StackOverflow says that I need this:

<body oncontextmenu="return false;">

And indeed, it works. Is there a way to do this in EWB? I can hack the html file,
but a proper way would be nice.

I just tried this, but it doesn't compile due to no OnContextMenu property, which
doesn't exist in the framework at all:
 GetBodyElement.OnContextMenu := MyContextMenu;

/Matthew Jones/
Tue, Jul 2 2013 9:03 AMPermanent Link

Matthew Jones

I've now found that in Chromium I can stop the popup using OnBeforeMenu, and the
most useful thing is that the Result is True to stop the menu, not false as you
might expect. I can stop the popup window navigating to another site too from my
normal links (I shall redirect them to the default browser instead).

It might still be nice to know the answer as to how to add to the DOM.

/Matthew Jones/
Tue, Jul 2 2013 1:27 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

<< I've now found that in Chromium I can stop the popup using OnBeforeMenu,
and the most useful thing is that the Result is True to stop the menu, not
false as you might expect. I can stop the popup window navigating to another
site too from my normal links (I shall redirect them to the default browser
instead).

It might still be nice to know the answer as to how to add to the DOM. >>

You have to add an event listener for the document (or the relevant element)
in order to listen for, and cancel the default behavior.  You can do this
with your own code, but it is probably best that I add support for it in the
new event manager.

Tim Young
Elevate Software
www.elevatesoft.com
Tue, Jul 2 2013 1:28 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

Look at:

procedure TEventManager.SetEventHandlers;

in the WebCtrls unit.  That will give you an idea of how to capture/delegate
such an event for all elements in the application.  But, again, this is
probably above and beyond what you care to muck about with. Smile

Tim Young
Elevate Software
www.elevatesoft.com

Tue, Jul 2 2013 3:38 PMPermanent Link

Matthew Jones

"Tim Young [Elevate Software]" <timyoung@elevatesoft.com> wrote:
> Look at:
>
> procedure TEventManager.SetEventHandlers;
>
> in the WebCtrls unit.  That will give you an idea of how to
> capture/delegate such an event for all elements in the application.  But,
> again, this is probably above and beyond what you care to muck about with. Smile

Thanks - I will investigate. I think it is good that we can add obscure
things if needed - you can't have the whole kitchen sink in the framework.

--
Matthew Jones
Mon, Jul 8 2013 2:20 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

<< Thanks - I will investigate. I think it is good that we can add obscure
things if needed - you can't have the whole kitchen sink in the framework.
>>

I agree, but certain things like common events are going to have to be
handled in a standardized way.

Tim Young
Elevate Software
www.elevatesoft.com
Image