Welcome Guest Search | Active Topics | Sign In | Register

Get URI when right click Options
Rick Morayniss
Posted: Thursday, November 6, 2014 3:11:59 PM
Rank: Advanced Member
Groups: Member

Joined: 12/30/2013
Posts: 68
I have asked this before but never got a satifactory answer so i will try again (all issues work in ie webbrowser from ms).
When a user right clicks on a data line to bring us a custom menu, the users ID ( and other info) is added to the rightclick memnu item (but not seen on the menu). All the user see's is the name of the menu objeft (upload, download, etc)
In the ms browser version(see below) the e.Url gives me the additional information that was added to the string

private void wb_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
tsStatusLabel.Text = "";
AddMessage("[Event] DocumentCompleted : [URL]: " + e.Url);
ExecuteURLTriggeredEvents(e.Url);
}
In going through your docs and help ,it seems like the best way to duplicate this is
private void webView1_IsLoadingChanged(object sender, EventArgs e)
{
var webView1 = (EO.WebBrowser.WebView)sender;

string strurl = webView1.Url;
if (strurl != "")
{
Uri myUri = new System.Uri(webView1.Url);
tsStatusLabel.Text = "";
}

ExecuteURLTriggeredEvents(myUri);

}


But the problem is I only get the original URl, I do not get the additional data added.
eo_support
Posted: Thursday, November 6, 2014 9:14:49 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Hi,

I am not sure if I understand your question correctly. If you are just talking about the context menu on right click, then you would need to handle this event:

http://www.essentialobjects.com/doc/6/eo.webbrowser.webview.beforecontextmenu.aspx

Inside this event you would need to built the context menu yourself, see here for more details:

http://www.essentialobjects.com/doc/6/customize/context_menu.aspx

You would also get the Url through e.MenuInfo object. This object contains various properties such as LinkUrl for the new Url to be opened, PageUrl for the current page Url that contains the link, and a number of other properties. You would need to save the Url value in a variable so that later when a context menu item is clicked (at which point WebView.Command event is triggered) you can act accordingly.

Hope this helps. Please feel free to let us know if you still have any questions.

Thanks!
Rick Morayniss
Posted: Friday, November 7, 2014 3:13:36 PM
Rank: Advanced Member
Groups: Member

Joined: 12/30/2013
Posts: 68
Do you have a small running example of this process?
eo_support
Posted: Friday, November 7, 2014 10:04:10 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Hi,

You can take a look of our TabbedBrowser sample source code. That sample already handle both events (BeforeContextMenu and Command). All you need to do is to add the code you needed in the event handler. The code you need to add in BeforeContextMenu is very straight forward, you just get the link Url:

Code: C#
//Get the target link Url inside BeforeContextMenu handler
string targetUrl = e.MenuInfo.LinkUrl;


Once you have the targetUrl, you can do whatever you want to do with it inside your Command event handler (you can't do anything with it inside BeforeContextMenu handler since you have to wait until the context menu is displayed and user clicks it, as such you probably want to save targetUrl in a member variable).

Hope this helps.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.