Jump to content


Willkommen im Coresystems Community Forum

Dieses Forum wird nicht mehr weiter betrieben.
Sollten Sie eine Lösung für eine spezifische Aufgabenstellung suchen wenden Sie sich bitte an unseren Support: helpdesk.coresystems.ch.
Für allgemeine Produktinformationen kontaktieren Sie unser Sales-Team: sales@coresystems.ch

Welcome at the coresystems community forum

This forum is no longer being maintained.
If you need a specific solution please contact our support: helpdesk.coresystems.ch.
For general product information do not hesitate to contact our sales team: sales@coresystems.ch

Photo
- - - - -

Create your own Right click menu on a Sales Order


  • Please log in to reply
3 replies to this topic

#1 Paolo Manfrin

Paolo Manfrin

    Advanced Member

  • Moderators
  • 418 posts
  • LocationSwitzerland

Posted 1 July 2014 - 16:11

The following code snippet shows you how to create your own menu when right clicking on a matrix row number:



newMenu.AddHandler_Click(delegate(SwissAddonFramework.UI.EventHandling.MenuEvents.MenuClick e)
{
    MessageBox.Show("Menu clicked", "OK");
});

// Enable the menu on the sales order matrix
Form.AddHandler_Load("139", ModeComponent.FormModes.ALL, delegate(SwissAddonFramework.UI.EventHandling.ItemEvents.FormLoad e)
{
   MenuItem dataMenu = MenuItem.GetFromUID("1280");

   MenuItem newMenu = MenuItem.CreateNew("NEWMENU1");
   newMenu.Value = "New Menu Item";
   newMenu.Type = MenuItem.MenuType.String;
   dataMenu.SubMenus.AddMenuItem(newMenu);

   dataMenu.Load();

    Matrix matrix = Matrix.GetFromUID(e.Form, "38");
    matrix.Columns[0].AddHandler_RightClick(

        delegate(SwissAddonFramework.UI.EventHandling.ItemEvents.RightClick e2)
        {
            MenuItem.GetFromUID("NEWMENU1").Enabled = true;
        },
        delegate(SwissAddonFramework.UI.EventHandling.ItemEvents.RightClick e2)
        {
            MenuItem.GetFromUID("NEWMENU1").Enabled = false;
        });
});



#2 TodAnderson

TodAnderson

    Member

  • Members
  • PipPip
  • 13 posts

Posted 27 November 2014 - 12:45

Hi Paolo,

 

I have used your code in an own form, and it works very nicely... except, it executes several times.

 

if I close SAP, then open the form and execute the right click it runs once. good!

close just the form, then reopen it and execute the right click again and it runs twice.. repeat, three times... and so on till I close SAP and start over.

 

Any ideas why?



#3 Paolo Manfrin

Paolo Manfrin

    Advanced Member

  • Moderators
  • 418 posts
  • LocationSwitzerland

Posted 27 November 2014 - 13:21

Hi, yes

because every time you are actually registering a new event :-)

 

Try with matrix.Columns[0].RemoveAllHandlers() before calling matrix.Columns[0].AddHandler_RightClick(...)

 

hth

paolo



#4 TodAnderson

TodAnderson

    Member

  • Members
  • PipPip
  • 13 posts

Posted 28 November 2014 - 14:12

Thanks






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users