jdtrent
(Joe D Trent)
March 26, 2019, 10:41pm
1
Hey all,
I thought this might be under a tool click form event, but can’t seem to catch it:
In case the image doesn’t come through I’ve right-clicked on the assembly under quote>line>manufacturing to select “Get Details…”
We’re catching this from the Actions menu, but the context menu click has eluded me.
I need to catch the click and display a message before the Get Details form loads.
I’ve tried catching it in before tool click and in tool click, plus before adapter for QuoteAsm with no joy.
Thanks,
Joe
Banderson
(Brandon Anderson)
March 26, 2019, 10:57pm
2
Why not just do it in pre-procesing on get details in a BPM? Then it covers everywhere.
1 Like
jdtrent
(Joe D Trent)
March 27, 2019, 12:51pm
3
Hi Brandon,
I need the message to pop up before we get to that point.
Thanks,
Joe
Can you share your ToolClick Code attempt? There is BeforeToolClick, AfterToolClick and ToolClick. It should emit the “GetDetailsTool” case.
But ultimately, remember the Context Menu is just the Menu each item on it is a Button. Which is registered with the baseToolsManager.
// Theoretical
EpiButton myButton = baseToolbarsManager.Tools["GetDetailsTool"];
// then you can add Click event to myButton
jdtrent
(Joe D Trent)
March 27, 2019, 1:27pm
5
I’ve used the BeforeToolClick and the ToolClick. I can add a message box and see the actions, including a “GetDetailsTool” if I choose Actions>QuoteLine>Get Details, but nothing when I right-click on the assembly under Line>Manufacturing–it goes straight to the Get Details form without hitting the tool click code.
Thanks,
Joe
dhewi
(Daryl Hewison)
March 27, 2019, 1:30pm
6
I suspect this is actually a right-click on a control, isn’t it? The tree view is not a tool as such, it’s a type of control.
jdtrent
(Joe D Trent)
March 27, 2019, 1:32pm
7
Yes, I’m right-clicking on assemby 0 in the tree under the quote line>manufacturing tab. That gives me an idea.
Thanks,
Joe
You are right, I forgot.
See if you can find the Control under:
oTrans.JobTree.TreeContextMenu.MenuItems
Here is a boilerplate from Jose, showing how to add your own button. It should help. Quote Entry and Sales Order Entry both use Job Tree Lib.
// **************************************************
// Custom code for JobEntryForm
// Created: 7/26/2018 12:18:09 PM
// **************************************************
extern alias Erp_Contracts_BO_Project;
extern alias Erp_Contracts_BO_Part;
using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Erp.Adapters;
using Erp.UI;
using Ice.Lib;
using Ice.Adapters;
using Ice.Lib.Customization;
using Ice.Lib.ExtendedProps;
using Ice.Lib.Framework;
using Ice.Lib.Searches;
using Ice.UI.FormFunctions;
public class Script
{
// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
// Begin Wizard Added Module Level Variables **
// End Wizard Added Module Level Variables **
// Add Custom Module Level Variables Here **
MenuItem findAssy =null;
public void InitializeCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
// Begin Wizard Added Variable Initialization
// End Wizard Added Variable Initialization
// Begin Wizard Added Custom Method Calls
// End Wizard Added Custom Method Calls
findAssy = new MenuItem("Go To Assy Num", new EventHandler(cmFindAssy));
oTrans.JobTree.BeforeShowContextMenu += new Ice.Lib.Framework.JobLib.MethodTree.BeforeShowContextMenuHandler(jobTree_BeforeShowContextMenu1);
}
public void DestroyCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
// Begin Wizard Added Object Disposal
// End Wizard Added Object Disposal
// Begin Custom Code Disposal
// End Custom Code Disposal
oTrans.JobTree.BeforeShowContextMenu -= new Ice.Lib.Framework.JobLib.MethodTree.BeforeShowContextMenuHandler(jobTree_BeforeShowContextMenu1);
}
private void cmFindAssy(object sender, System.EventArgs e)
{
MessageBox.Show("Do Search ,lookup work here");
}
private void jobTree_BeforeShowContextMenu1(object sender, Ice.Lib.Framework.JobLib.MethodTree.NodeArgs e)
{
oTrans.JobTree.TreeContextMenu.MenuItems.Add(findAssy);
}
}
jdtrent
(Joe D Trent)
March 27, 2019, 1:58pm
9
Great! I’ll give it a try.
Thanks,
Joe