Welcome Guest Search | Active Topics | Sign In | Register

RegisterUserCommand Options
myWorkspace
Posted: Thursday, July 7, 2016 12:12:03 PM
Rank: Member
Groups: Member

Joined: 1/6/2016
Posts: 19
Hi,

I am trying to modify the context menu, in which I am adding a menuitem, and trying to bind it to a user defined command.

Public ICommand testcommand;
public int testmenuId
public ViewModel()
{
testcommand = new ActionCommand(testfunction);
testmenuId = CommandIds.RegisterUserCommand(testcommand);
}
public void testfunction()
{
...................
}

but I It never hits the testfunction.I have also tried

testmenuId = CommandIds.RegisterUserCommand("testcommand"); but there was no result. Can you plesae help me getting this done.

Thanks.
eo_support
Posted: Thursday, July 7, 2016 1:30:49 PM
Rank: Administration
Groups: Administration

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

RegisterUserCommand only gives you a command ID. You still need to handle BeforeContextMenu event to add a menu item that triggers that ID.

Thanks!
myWorkspace
Posted: Thursday, July 7, 2016 1:34:58 PM
Rank: Member
Groups: Member

Joined: 1/6/2016
Posts: 19
I have added the CommandId to the Context menu as below

e.Menu.Items.Add(new EO.WebBrowser.MenuItem("Test Menu item", testmenuId );. It is showing up in the context menu, but when selected/clicked, nothing happens
eo_support
Posted: Thursday, July 7, 2016 2:22:38 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,275
You also need to handle the WebView's Command event. No where in the documentation that tells you you can use use an ActionCommand object with RegisterUserCommand. So you can't just pull it out of your head and expect it to work. See here for more information on how to handle command:

http://www.essentialobjects.com/doc/webbrowser/customize/hot_key.aspx

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.