Adding ButtonTool in Context Menu via Coding

Hello folks,

I want to add new button in right click of context menu (not via context menu maintenance) in Part Entry which will call another form. Since this is need on specific customization, i want to add buttonTool on this customization only when it get right click on Part field.

Hope there is way.

So you want a button on the Part entry form to appear when the Part field is right clicked?

And just when the field is right clicked, not when a specific context menu item is selected. Correct?

This should do it

oTrans.RegisterContextHandler("QuoteHed.CustNum", "Click this...", handleContextClick); 
 
    object handleContextClick(object sender, object currentValue) 
    {
        MessageBox.Show("Current value is: " + currentValue.ToString() + "; setting to 'foo'");
        return "foo";
    }
5 Likes

Hi Calvin,

Thanks for your reply. I will explain with Eg.
I have 3 Site, and 3 different customization of RMA Processing Entry with relevant to Site.
Suppose I am in Site1.
In Case Management, when i right click to RMA textbox, it will show 3 Menu (RMA Processing Entry, RMA Tracker and RMA Processing Search).
If I click RMA Processing Entry, instead of base form I want to open Site 1 RMA Customization. For this, I can hide base form of RMA Processing menu when right click and add new Menu dynamically on right click which will call Site specific customization.

When I am in Site2, when right click RMA Processing Entry, it should open Site 2 Customization only.

If I use context menu, then it will show to all site. Thats’y I need to do in coding level.

I hope I able to explain.

Hanky :slight_smile:

thanks jose. it work
Can we manage the sequence of menu like if i need to show in middle or at very first menu. Is this possible?

Maybe add all three Menus in Context Menu Maintenance, and then use code in a customization to remove the ones you don’t want

Hi Calvin,

I though of doing this but I couldn’t do it as I am not aware of coding how to achieve this.
I checked in database this ContextMenu table, its Empty. I am surprise where this all context menu are storing in DB. So due to this, I skip to do this method.
If you have code then kindly share. thanks.