Ejemplo n.º 1
0
        private void barManager1_QueryShowPopupMenu(object sender, DevExpress.XtraBars.QueryShowPopupMenuEventArgs e)
        {
            Point position            = e.Control.PointToClient(e.Position);
            SpellCheckErrorBase error = spellChecker1.CalcError(position);

            e.Cancel = error == null;
            List <SpellCheckerCommand> commands = spellChecker1.GetCommandsByError(error);

            if (commands != null)
            {
                popupMenu1.ItemLinks.Clear();
                foreach (SpellCheckerCommand command in commands)
                {
                    BarButtonItem item = new BarButtonItem(barManager1, command.Caption);
                    item.Enabled    = command.Enabled;
                    item.Tag        = command;
                    item.ItemClick += new ItemClickEventHandler(OnPopupMenuItemClick);
                    popupMenu1.ItemLinks.Add(item);
                }
            }
            BarButtonItem bitem = new BarButtonItem(barManager1, "Option");

            bitem.Enabled = true;
            //bitem.Tag = command;
            bitem.ItemClick += new ItemClickEventHandler(Option_Click);
            popupMenu1.ItemLinks.Add(bitem);
        }
Ejemplo n.º 2
0
        private void barManager_QueryShowPopupMenu(object sender, DevExpress.XtraBars.QueryShowPopupMenuEventArgs e)
        {
            if (e.Menu == pmList)
            {
                e.Cancel = uxImagesView.SelectedItem == null;
            }
            else if (e.Menu == pmTree)
            {
                int            treeLevel = 0;
                dsTree.TreeRow row       = null;
                if (uxWhere.Properties.TreeList.Selection.Count > 0)
                {
                    TreeListNode node = uxWhere.Properties.TreeList.Selection[0];
                    treeLevel = node.Level;
                    row       = (uxWhere.Properties.TreeList.GetDataRecordByNode(node) as DataRowView).Row as dsTree.TreeRow;
                }
                else
                {
                    row = treeTable.FindByID((int)uxWhere.EditValue);

                    if (row.ParentID == -1)
                    {
                        treeLevel = 0;
                    }
                    else if (row.ParentID == 1)
                    {
                        treeLevel = 1;
                    }
                    else
                    {
                        treeLevel = 2;
                    }
                }

                if (treeLevel == 0)
                {
                    cmdManage.Visibility               = BarItemVisibility.Always;
                    cmdOpenFolder.Visibility           =
                        cmdOpenFile.Visibility         =
                            cmdChangeFolder.Visibility =
                                BarItemVisibility.Never;
                }
                else if (treeLevel == 1)
                {
                    bool shared     = row == treeBuilder.RowShared;
                    bool configured = !row.Data.Equals(System.DBNull.Value);

                    cmdOpenFolder.Visibility   = configured ? BarItemVisibility.Always : BarItemVisibility.Never;
                    cmdManage.Visibility       =
                        cmdOpenFile.Visibility =
                            BarItemVisibility.Never;
                    cmdChangeFolder.Visibility = shared ? BarItemVisibility.Always : BarItemVisibility.Never;
                }
                else if (treeLevel == 2)
                {
                    cmdOpenFolder.Visibility   =
                        cmdOpenFile.Visibility =
                            BarItemVisibility.Always;
                    cmdManage.Visibility           =
                        cmdChangeFolder.Visibility =
                            BarItemVisibility.Never;
                }
            }
        }