Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Blocking all navigation and events to Browser from interface.
Blocking all navigation and events to Browser from interface. [message #456723] Tue, 07 June 2005 17:21 Go to next message
Mark Diggory is currently offline Mark DiggoryFriend
Messages: 202
Registered: July 2009
Senior Member
I'm trying to use the Browser widget as a "Preview" of editor content.
I'd like to block (and possibly override) the users ability to activate
Links and form submit fields in the Browser so that they cannot navigate
off of the page. What is the best way to approach this?

thanks,
Mark Diggory
Re: Blocking all navigation and events to Browser from interface. [message #456748 is a reply to message #456723] Wed, 08 June 2005 12:56 Go to previous messageGo to next message
Mark Diggory is currently offline Mark DiggoryFriend
Messages: 202
Registered: July 2009
Senior Member
Any takers? I think this has to be a common usecase?

Mark Diggory wrote:
> I'm trying to use the Browser widget as a "Preview" of editor content.
> I'd like to block (and possibly override) the users ability to activate
> Links and form submit fields in the Browser so that they cannot navigate
> off of the page. What is the best way to approach this?
>
> thanks,
> Mark Diggory
Re: Blocking all navigation and events to Browser from interface. [message #456751 is a reply to message #456748] Wed, 08 June 2005 13:40 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
Mark,

You can veto or modify page changes in the changing event, as shown below:

browser.addLocationListener(new LocationAdapter() {
public void changing(LocationEvent event) {
event.doit = false; /* veto link traversals */
}
});

Grant

"Mark Diggory" <mdiggory@apache.org> wrote in message
news:42A6EAFC.50607@apache.org...
> Any takers? I think this has to be a common usecase?
>
> Mark Diggory wrote:
> > I'm trying to use the Browser widget as a "Preview" of editor content.
> > I'd like to block (and possibly override) the users ability to activate
> > Links and form submit fields in the Browser so that they cannot navigate
> > off of the page. What is the best way to approach this?
> >
> > thanks,
> > Mark Diggory
Re: Blocking all navigation and events to Browser from interface. [message #456777 is a reply to message #456751] Wed, 08 June 2005 14:02 Go to previous messageGo to next message
Mark Diggory is currently offline Mark DiggoryFriend
Messages: 202
Registered: July 2009
Senior Member
Very cool, thank you.

Grant Gayed wrote:
> Mark,
>
> You can veto or modify page changes in the changing event, as shown below:
>
> browser.addLocationListener(new LocationAdapter() {
> public void changing(LocationEvent event) {
> event.doit = false; /* veto link traversals */
> }
> });
>
> Grant
>
> "Mark Diggory" <mdiggory@apache.org> wrote in message
> news:42A6EAFC.50607@apache.org...
>
>>Any takers? I think this has to be a common usecase?
>>
>>Mark Diggory wrote:
>>
>>>I'm trying to use the Browser widget as a "Preview" of editor content.
>>>I'd like to block (and possibly override) the users ability to activate
>>>Links and form submit fields in the Browser so that they cannot navigate
>>>off of the page. What is the best way to approach this?
>>>
>>>thanks,
>>>Mark Diggory
>
>
>
Re: Blocking all navigation and events to Browser from interface. [message #456827 is a reply to message #456751] Thu, 09 June 2005 23:01 Go to previous messageGo to next message
Mark Diggory is currently offline Mark DiggoryFriend
Messages: 202
Registered: July 2009
Senior Member
I have another question; Can this detect the difference between
traversing a link/form and a call to setUrl/setHtml? I only want to
block link traversal, not setUrl/Html.

-Mark


Grant Gayed wrote:
> Mark,
>
> You can veto or modify page changes in the changing event, as shown below:
>
> browser.addLocationListener(new LocationAdapter() {
> public void changing(LocationEvent event) {
> event.doit = false; /* veto link traversals */
> }
> });
>
> Grant
>
> "Mark Diggory" <mdiggory@apache.org> wrote in message
> news:42A6EAFC.50607@apache.org...
>
>>Any takers? I think this has to be a common usecase?
>>
>>Mark Diggory wrote:
>>
>>>I'm trying to use the Browser widget as a "Preview" of editor content.
>>>I'd like to block (and possibly override) the users ability to activate
>>>Links and form submit fields in the Browser so that they cannot navigate
>>>off of the page. What is the best way to approach this?
>>>
>>>thanks,
>>>Mark Diggory
>
>
>
Re: Blocking all navigation and events to Browser from interface. [message #456839 is a reply to message #456827] Fri, 10 June 2005 14:00 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
The LocationEvent does not differentiate between these two cases, but if you
set the url or text into the Browser, you should be able to determine from
the resulting callback that its location field matches the url that you just
set in.

Grant

"Mark Diggory" <mdiggory@apache.org> wrote in message
news:42A8CA3C.8090304@apache.org...
> I have another question; Can this detect the difference between
> traversing a link/form and a call to setUrl/setHtml? I only want to
> block link traversal, not setUrl/Html.
>
> -Mark
>
>
> Grant Gayed wrote:
> > Mark,
> >
> > You can veto or modify page changes in the changing event, as shown
below:
> >
> > browser.addLocationListener(new LocationAdapter() {
> > public void changing(LocationEvent event) {
> > event.doit = false; /* veto link traversals */
> > }
> > });
> >
> > Grant
> >
> > "Mark Diggory" <mdiggory@apache.org> wrote in message
> > news:42A6EAFC.50607@apache.org...
> >
> >>Any takers? I think this has to be a common usecase?
> >>
> >>Mark Diggory wrote:
> >>
> >>>I'm trying to use the Browser widget as a "Preview" of editor content.
> >>>I'd like to block (and possibly override) the users ability to activate
> >>>Links and form submit fields in the Browser so that they cannot
navigate
> >>>off of the page. What is the best way to approach this?
> >>>
> >>>thanks,
> >>>Mark Diggory
> >
> >
> >
Re: Blocking all navigation and events to Browser from interface. [message #456840 is a reply to message #456839] Fri, 10 June 2005 15:18 Go to previous messageGo to next message
Mark Diggory is currently offline Mark DiggoryFriend
Messages: 202
Registered: July 2009
Senior Member
Yes, I thought this as a solution, but found it unfavorable over simply
being able to tell the difference between the events. Maybe even if the
events generated also showed the method as well as the widget that was
their source.

-Mark


Grant Gayed wrote:
> The LocationEvent does not differentiate between these two cases, but if you
> set the url or text into the Browser, you should be able to determine from
> the resulting callback that its location field matches the url that you just
> set in.
>
> Grant
>
> "Mark Diggory" <mdiggory@apache.org> wrote in message
> news:42A8CA3C.8090304@apache.org...
>
>>I have another question; Can this detect the difference between
>>traversing a link/form and a call to setUrl/setHtml? I only want to
>>block link traversal, not setUrl/Html.
>>
>>-Mark
>>
>>
>>Grant Gayed wrote:
>>
>>>Mark,
>>>
>>>You can veto or modify page changes in the changing event, as shown
>
> below:
>
>>>browser.addLocationListener(new LocationAdapter() {
>>> public void changing(LocationEvent event) {
>>> event.doit = false; /* veto link traversals */
>>> }
>>>});
>>>
>>>Grant
>>>
>>>"Mark Diggory" <mdiggory@apache.org> wrote in message
>>>news:42A6EAFC.50607@apache.org...
>>>
>>>
>>>>Any takers? I think this has to be a common usecase?
>>>>
>>>>Mark Diggory wrote:
>>>>
>>>>
>>>>>I'm trying to use the Browser widget as a "Preview" of editor content.
>>>>>I'd like to block (and possibly override) the users ability to activate
>>>>>Links and form submit fields in the Browser so that they cannot
>
> navigate
>
>>>>>off of the page. What is the best way to approach this?
>>>>>
>>>>>thanks,
>>>>>Mark Diggory
>>>
>>>
>>>
>
>
Re: Blocking all navigation and events to Browser from interface. [message #457073 is a reply to message #456751] Wed, 15 June 2005 23:21 Go to previous messageGo to next message
Alex Le is currently offline Alex LeFriend
Messages: 649
Registered: July 2009
Senior Member
Well...The thing about the below solution is that it will veto, that is,
won't display anything, when you do a Browser.setText(String text),
where 'text' contains html text at the beginning.

Grant Gayed wrote:

> Mark,
>
> You can veto or modify page changes in the changing event, as shown below:
>
> browser.addLocationListener(new LocationAdapter() {
> public void changing(LocationEvent event) {
> event.doit = false; /* veto link traversals */
> }
> });
>
> Grant
>
> "Mark Diggory" <mdiggory@apache.org> wrote in message
> news:42A6EAFC.50607@apache.org...
>
>>Any takers? I think this has to be a common usecase?
>>
>>Mark Diggory wrote:
>>
>>>I'm trying to use the Browser widget as a "Preview" of editor content.
>>>I'd like to block (and possibly override) the users ability to activate
>>>Links and form submit fields in the Browser so that they cannot navigate
>>>off of the page. What is the best way to approach this?
>>>
>>>thanks,
>>>Mark Diggory
>
>
>
Re: Blocking all navigation and events to Browser from interface. [message #457074 is a reply to message #457073] Wed, 15 June 2005 23:23 Go to previous messageGo to next message
Alex Le is currently offline Alex LeFriend
Messages: 649
Registered: July 2009
Senior Member
"at the beginning" means the initial page that you want to display.

AL wrote:

> Well...The thing about the below solution is that it will veto, that is,
> won't display anything, when you do a Browser.setText(String text),
> where 'text' contains html text at the beginning.
>
> Grant Gayed wrote:
>
>> Mark,
>>
>> You can veto or modify page changes in the changing event, as shown
>> below:
>>
>> browser.addLocationListener(new LocationAdapter() {
>> public void changing(LocationEvent event) {
>> event.doit = false; /* veto link traversals */
>> }
>> });
>>
>> Grant
>>
>> "Mark Diggory" <mdiggory@apache.org> wrote in message
>> news:42A6EAFC.50607@apache.org...
>>
>>> Any takers? I think this has to be a common usecase?
>>>
>>> Mark Diggory wrote:
>>>
>>>> I'm trying to use the Browser widget as a "Preview" of editor content.
>>>> I'd like to block (and possibly override) the users ability to activate
>>>> Links and form submit fields in the Browser so that they cannot
>>>> navigate
>>>> off of the page. What is the best way to approach this?
>>>>
>>>> thanks,
>>>> Mark Diggory
>>
>>
>>
>>
>
Re: Blocking all navigation and events to Browser from interface. [message #457158 is a reply to message #457073] Mon, 20 June 2005 11:26 Go to previous messageGo to next message
Mark Diggory is currently offline Mark DiggoryFriend
Messages: 202
Registered: July 2009
Senior Member
Thats the problem, theres not enough granularity to the location
listener api for what developers would want to do with it.

Another idea I had was to block all Mouse events by removing all the
mouselisteners from my browser instance, but from what I see, theres no
way to get hold of the set and remove them without extending Browser
directly.

-Mark

AL wrote:
> Well...The thing about the below solution is that it will veto, that is,
> won't display anything, when you do a Browser.setText(String text),
> where 'text' contains html text at the beginning.
>
> Grant Gayed wrote:
>
>> Mark,
>>
>> You can veto or modify page changes in the changing event, as shown
>> below:
>>
>> browser.addLocationListener(new LocationAdapter() {
>> public void changing(LocationEvent event) {
>> event.doit = false; /* veto link traversals */
>> }
>> });
>>
>> Grant
>>
>> "Mark Diggory" <mdiggory@apache.org> wrote in message
>> news:42A6EAFC.50607@apache.org...
>>
>>> Any takers? I think this has to be a common usecase?
>>>
>>> Mark Diggory wrote:
>>>
>>>> I'm trying to use the Browser widget as a "Preview" of editor content.
>>>> I'd like to block (and possibly override) the users ability to activate
>>>> Links and form submit fields in the Browser so that they cannot
>>>> navigate
>>>> off of the page. What is the best way to approach this?
>>>>
>>>> thanks,
>>>> Mark Diggory
>>
>>
>>
>>
>
Re: Blocking all navigation and events to Browser from interface. [message #457199 is a reply to message #457158] Tue, 21 June 2005 02:51 Go to previous messageGo to next message
Mark Diggory is currently offline Mark DiggoryFriend
Messages: 202
Registered: July 2009
Senior Member
Not only can I not remove mouselisteners, they are never reported any
events from the browser. I click on the widget and no event is generated
in a mouselistener I added to the Browser.

This is frustrating, theres no real solution to getting this granularity
at the moment.

Is it possible that I can layer some transparent widget or label over
the browser component to block any mouse events from getting to the
browser widget?

-Mark

Mark Diggory wrote:
> Thats the problem, theres not enough granularity to the location
> listener api for what developers would want to do with it.
>
> Another idea I had was to block all Mouse events by removing all the
> mouselisteners from my browser instance, but from what I see, theres no
> way to get hold of the set and remove them without extending Browser
> directly.
>
> -Mark
>
> AL wrote:
>
>> Well...The thing about the below solution is that it will veto, that
>> is, won't display anything, when you do a Browser.setText(String
>> text), where 'text' contains html text at the beginning.
>>
>> Grant Gayed wrote:
>>
>>> Mark,
>>>
>>> You can veto or modify page changes in the changing event, as shown
>>> below:
>>>
>>> browser.addLocationListener(new LocationAdapter() {
>>> public void changing(LocationEvent event) {
>>> event.doit = false; /* veto link traversals */
>>> }
>>> });
>>>
>>> Grant
>>>
>>> "Mark Diggory" <mdiggory@apache.org> wrote in message
>>> news:42A6EAFC.50607@apache.org...
>>>
>>>> Any takers? I think this has to be a common usecase?
>>>>
>>>> Mark Diggory wrote:
>>>>
>>>>> I'm trying to use the Browser widget as a "Preview" of editor content.
>>>>> I'd like to block (and possibly override) the users ability to
>>>>> activate
>>>>> Links and form submit fields in the Browser so that they cannot
>>>>> navigate
>>>>> off of the page. What is the best way to approach this?
>>>>>
>>>>> thanks,
>>>>> Mark Diggory
>>>
>>>
>>>
>>>
>>>
>>
Re: Blocking all navigation and events to Browser from interface. [message #457216 is a reply to message #457199] Tue, 21 June 2005 20:31 Go to previous messageGo to next message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
You can block all mouse events to any widget (including the browser) by
placing it inside a disabled composite. The following snippet intercepts
mouse events to a button using this approach:

http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/eclipse/swt/snippets/Snippet46.java?rev=HEAD&a mp;content-type=text/vnd.viewcvs-markup

"Mark Diggory" <mdiggory@apache.org> wrote in message
news:42B780A0.8090903@apache.org...
> Not only can I not remove mouselisteners, they are never reported any
> events from the browser. I click on the widget and no event is generated
> in a mouselistener I added to the Browser.
>
> This is frustrating, theres no real solution to getting this granularity
> at the moment.
>
> Is it possible that I can layer some transparent widget or label over
> the browser component to block any mouse events from getting to the
> browser widget?
>
> -Mark
>
> Mark Diggory wrote:
> > Thats the problem, theres not enough granularity to the location
> > listener api for what developers would want to do with it.
> >
> > Another idea I had was to block all Mouse events by removing all the
> > mouselisteners from my browser instance, but from what I see, theres no
> > way to get hold of the set and remove them without extending Browser
> > directly.
> >
> > -Mark
> >
> > AL wrote:
> >
> >> Well...The thing about the below solution is that it will veto, that
> >> is, won't display anything, when you do a Browser.setText(String
> >> text), where 'text' contains html text at the beginning.
> >>
> >> Grant Gayed wrote:
> >>
> >>> Mark,
> >>>
> >>> You can veto or modify page changes in the changing event, as shown
> >>> below:
> >>>
> >>> browser.addLocationListener(new LocationAdapter() {
> >>> public void changing(LocationEvent event) {
> >>> event.doit = false; /* veto link traversals */
> >>> }
> >>> });
> >>>
> >>> Grant
> >>>
> >>> "Mark Diggory" <mdiggory@apache.org> wrote in message
> >>> news:42A6EAFC.50607@apache.org...
> >>>
> >>>> Any takers? I think this has to be a common usecase?
> >>>>
> >>>> Mark Diggory wrote:
> >>>>
> >>>>> I'm trying to use the Browser widget as a "Preview" of editor
content.
> >>>>> I'd like to block (and possibly override) the users ability to
> >>>>> activate
> >>>>> Links and form submit fields in the Browser so that they cannot
> >>>>> navigate
> >>>>> off of the page. What is the best way to approach this?
> >>>>>
> >>>>> thanks,
> >>>>> Mark Diggory
> >>>
> >>>
> >>>
> >>>
> >>>
> >>
Re: Blocking all navigation and events to Browser from interface. [message #457240 is a reply to message #457216] Wed, 22 June 2005 14:08 Go to previous message
Mark Diggory is currently offline Mark DiggoryFriend
Messages: 202
Registered: July 2009
Senior Member
Yes, that almost meets my needs, I disable the Browser composite and the
navigation can still occur but the mouse events are blocked, thanks.

However, there is a shortfall, I loose all event ability including
scrolling the page after this.

thanks,
-Mark
Steve Northover wrote:
> You can block all mouse events to any widget (including the browser) by
> placing it inside a disabled composite. The following snippet intercepts
> mouse events to a button using this approach:
>
> http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/eclipse/swt/snippets/Snippet46.java?rev=HEAD&a mp;content-type=text/vnd.viewcvs-markup
>
> "Mark Diggory" <mdiggory@apache.org> wrote in message
> news:42B780A0.8090903@apache.org...
>
>>Not only can I not remove mouselisteners, they are never reported any
>>events from the browser. I click on the widget and no event is generated
>>in a mouselistener I added to the Browser.
>>
>>This is frustrating, theres no real solution to getting this granularity
>>at the moment.
>>
>>Is it possible that I can layer some transparent widget or label over
>>the browser component to block any mouse events from getting to the
>>browser widget?
>>
>>-Mark
>>
>>Mark Diggory wrote:
>>
>>>Thats the problem, theres not enough granularity to the location
>>>listener api for what developers would want to do with it.
>>>
>>>Another idea I had was to block all Mouse events by removing all the
>>>mouselisteners from my browser instance, but from what I see, theres no
>>>way to get hold of the set and remove them without extending Browser
>>>directly.
>>>
>>>-Mark
>>>
>>>AL wrote:
>>>
>>>
>>>>Well...The thing about the below solution is that it will veto, that
>>>>is, won't display anything, when you do a Browser.setText(String
>>>>text), where 'text' contains html text at the beginning.
>>>>
>>>>Grant Gayed wrote:
>>>>
>>>>
>>>>>Mark,
>>>>>
>>>>>You can veto or modify page changes in the changing event, as shown
>>>>>below:
>>>>>
>>>>>browser.addLocationListener(new LocationAdapter() {
>>>>> public void changing(LocationEvent event) {
>>>>> event.doit = false; /* veto link traversals */
>>>>> }
>>>>>});
>>>>>
>>>>>Grant
>>>>>
>>>>>"Mark Diggory" <mdiggory@apache.org> wrote in message
>>>>>news:42A6EAFC.50607@apache.org...
>>>>>
>>>>>
>>>>>>Any takers? I think this has to be a common usecase?
>>>>>>
>>>>>>Mark Diggory wrote:
>>>>>>
>>>>>>
>>>>>>>I'm trying to use the Browser widget as a "Preview" of editor
>
> content.
>
>>>>>>>I'd like to block (and possibly override) the users ability to
>>>>>>>activate
>>>>>>>Links and form submit fields in the Browser so that they cannot
>>>>>>>navigate
>>>>>>>off of the page. What is the best way to approach this?
>>>>>>>
>>>>>>>thanks,
>>>>>>>Mark Diggory
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>
>
Previous Topic:SWT on MacOS 10.4 and JDK1.5 without java_swt wrapper
Next Topic:Added a "direction" arrow to a table column when sorting
Goto Forum:
  


Current Time: Fri Apr 26 07:33:26 GMT 2024

Powered by FUDForum. Page generated in 0.04228 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top