new option right click menu

Paul Witmond

Hi ,



I've added an option to the right click menu in the business partners





SwissAddonFramework.UI.Components.MenuItem RMenu = SwissAddonFramework.UI.Components.MenuItem.GetFromUID("1280");

SwissAddonFramework.UI.Components.MenuItem MoveRow = SwissAddonFramework.UI.Components.MenuItem.CreateNew("MoveRow");

MoveRow.Value = "move";

MoveRow.Position = 1;

RMenu.SubMenus.AddMenuItem(MoveRow);

MoveRow.AddHandler_Click(null, BP_Move);

RowNr = ev.Row;

BronForm = ev.Form.UniqueID;

RMenu.Load();



This is working fine but the new right click option is appearing on every screen and that's not what we need.



What can we do to get the new option ONLY on the BP right click ?





Thanks,



Paul

Thilo-Simon Studt

Try to use the FormActivate and FormDeactivate events to enable/disable your menu.



[CODE]

private void OnFormDeActivate(SwissAddonFramework.UI.EventHandling.ItemEvents.FormDeactivate e)

{

SwissAddonFramework.UI.Components.MenuItem.GetFromUID("MoveRow").Enabled = false;

}

private void OnFormActivate(SwissAddonFramework.UI.EventHandling.ItemEvents.FormActivate e)

{

SwissAddonFramework.UI.Components.MenuItem.GetFromUID("MoveRow").Enabled = true;

}

[/CODE]

Paolo Manfrin

Hi Paul,

you could eventually check the current active form and display the menu only in such case:



You can get the current active form using



[CODE]

SAPbouiCOM.Form oSAPForm = SwissAddonFramework.B1Connector.GetB1Connector().Application.Forms.ActiveForm;

[/CODE]



and then from the oSAPForm you can read-out the FormID or FormType



hth

paolo
0

Comments

0 comments

Please sign in to leave a comment.

Didn't find what you were looking for?

New post