Example #1
0
        private void OnPEDMenuOpening(object sender, EventArgs e)
        {
            ToolStripMenuItem tsmi = sender as ToolStripMenuItem;

            if (tsmi == null)
            {
                return;
            }
            if (tsmi.DropDown == null)
            {
                return;
            }
            PEDValue_QuickAction pqaActions = tsmi.DropDown.Tag as PEDValue_QuickAction;

            if (pqaActions == null)
            {
                return;
            }
            if ((tsmi == m_ContextMenuEntry) || (tsmi == m_MainMenuEntry))
            {
                PwEntry[]    pe         = m_host.MainWindow.GetSelectedEntries();
                PEDCalcValue pcvInherit = pe[0].GetPEDValueInherit();
                pqaActions.SetInheritValue(pcvInherit);
                pqaActions.SetValue(pe[0].GetPEDValue(false));
            }
            else if ((tsmi == m_ContextMenuGroup) || (tsmi == m_MainMenuGroup))
            {
                PwGroup      pg         = m_host.MainWindow.GetSelectedGroup();
                PEDCalcValue pcvInherit = pg.GetPEDValueInherit();
                pqaActions.SetInheritValue(pcvInherit);
                pqaActions.SetValue(pg.GetPEDValue(false));
            }
            else if (m_pweForm != null)
            {
                PwEntry pe = m_pweForm.EntryRef;
                m_pweForm.UpdateEntryStrings(true, true);
                PEDCalcValue currentValue = m_pweForm.EntryStrings.ReadPEDCString();
                if (currentValue == null)
                {
                    currentValue = pe.GetPEDValue(false);
                }
                pqaActions.SetInheritValue(pe.GetPEDValueInherit());
                pqaActions.SetValue(currentValue);
            }
        }