|
Rank: Member Groups: Member
Joined: 9/25/2014 Posts: 19
|
Hi,
I'd like open some links the site in others WebView, to work equal the Shortcut "Ctrl+Left Click".
Thanks.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi, The WebView already does that. What you need to do is to handle NewWindow event properly. See here for more details: http://www.essentialobjects.com/doc/6/advanced/new_window.aspxYou can find sample code in our TabbedBrowser sample project on how to handle this event. Thanks!
|
|
Rank: Member Groups: Member
Joined: 9/25/2014 Posts: 19
|
Hi, Is not what I need. My idea is create one item in ContextMenu "Open link in new tab" with shorcut "Ctrl + Left Click", that will open any links on the website, the choice is the user. Thanks.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi, In that case you would need to: 1. Customize the context menu with the specified short key. See here for more information on how to customize the context menu: http://www.essentialobjects.com/doc/6/customize/context_menu.aspxAs you can see, you will customize the context menu by handling BeforeContextMenu event. 2. Also in your BeforeContextMenu event handler, you will need to check the event argument's MenuInfo property to find out whether this is a context menu for a link, and if it is a link, what is the link Url. You can get this from these two properties: http://www.essentialobjects.com/doc/6/eo.webbrowser.contextmenusourceflags.aspxhttp://www.essentialobjects.com/doc/6/eo.webbrowser.contextmenuinfo.linkurl.aspx3. Handle the WebView's Command event: http://www.essentialobjects.com/doc/6/eo.webbrowser.webview.command.aspxThis event is triggered when user clicks a menu item in the context menu (each menu item will be associated to a different command id). Inside the event handler you can do whatever you want with the new Url. For example, if you want to disable the link, you can do nothing. If you want to load into the current WebView, you can call LoadUrl on the current WebView. If you want to load it into a new WebView, you can create a new WebView (along with the wrapper class, for example, if you uses Windows Forms then you need to create EO.WebBrowser.WinForm.WebControl) and load the Url you get in step 2 into the new WebView. Hope this helps. Thanks!
|
|
Rank: Member Groups: Member
Joined: 9/25/2014 Posts: 19
|
Hi, Thanks for fast reply. The steps 1,2 and event WebView.Command is perfect. My problem is how does get the clicked value URL for open in other WebView?
Code: C#
void WebView_Command(object sender, EO.WebBrowser.CommandEventArgs e)
{
if (e.CommandId.Equals(OpenNewTab))
{
//Get the URL and open in the new WebView
}
}
Thanks! eo_support wrote:Hi, In that case you would need to: 1. Customize the context menu with the specified short key. See here for more information on how to customize the context menu: http://www.essentialobjects.com/doc/6/customize/context_menu.aspxAs you can see, you will customize the context menu by handling BeforeContextMenu event. 2. Also in your BeforeContextMenu event handler, you will need to check the event argument's MenuInfo property to find out whether this is a context menu for a link, and if it is a link, what is the link Url. You can get this from these two properties: http://www.essentialobjects.com/doc/6/eo.webbrowser.contextmenusourceflags.aspxhttp://www.essentialobjects.com/doc/6/eo.webbrowser.contextmenuinfo.linkurl.aspx3. Handle the WebView's Command event: http://www.essentialobjects.com/doc/6/eo.webbrowser.webview.command.aspxThis event is triggered when user clicks a menu item in the context menu (each menu item will be associated to a different command id). Inside the event handler you can do whatever you want with the new Url. For example, if you want to disable the link, you can do nothing. If you want to load into the current WebView, you can call LoadUrl on the current WebView. If you want to load it into a new WebView, you can create a new WebView (along with the wrapper class, for example, if you uses Windows Forms then you need to create EO.WebBrowser.WinForm.WebControl) and load the Url you get in step 2 into the new WebView. Hope this helps. Thanks!
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
You can't get that in step 3. You would get it in step 2 and keep it somewhere later for step 3. :)
|
|
Rank: Member Groups: Member
Joined: 9/25/2014 Posts: 19
|
Hi Oh, sorry, great worked. ;) Thanks very much!!!! eo_support wrote:You can't get that in step 3. You would get it in step 2 and keep it somewhere later for step 3. :)
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
You are very welcome. Please feel free to let us know if you have any more questions.
Thanks!
|
|