private void AddOpenObjectButton(LookupPropertyEditor item)
        {
            Image img = ImageLoader.Instance.GetImageInfo("Editor_Edit").Image;
            var   ima = (Image)(new Bitmap(img, new Size(16, 16)));
            var   openObjectButton = new EditorButton(ButtonPredefines.Glyph, ima, new SuperToolTip());



            if (item.PropertyValue == null)
            {
                openObjectButton.Enabled = false;
            }

            openObjectButton.Enabled = openObjectButton.Enabled && Frame.GetController <OpenObjectController>().Active.ResultValue;

            item.Control.Properties.Buttons.Insert(0, openObjectButton);
            item.Control.Properties.ActionButtonIndex = item.Control.Properties.Buttons.Count - 1;


            EventHandler controlValueChanged = (s, e) =>
            {
                var openObjectController = this.Frame.GetController <OpenObjectController>();
                openObjectButton.Enabled = openObjectController.OpenObjectAction.Active.ResultValue && item.ControlValue != null;
            };

            item.ControlValueChanged += controlValueChanged;
            lookupPropertyEditorEventHandlers[item] = controlValueChanged;

            ButtonPressedEventHandler buttonClick = (s, e) =>
            {
                if (e.Button == openObjectButton)
                {
                    var openObjectController = this.Frame.GetController <OpenObjectController>();
                    openObjectController.OpenObjectAction.DoExecute();
                }
            };

            item.Control.ButtonClick += buttonClick;
            lookupEditEventHandlers[item.Control] = buttonClick;
        }
Exemplo n.º 2
0
        private void VCVentaABC_ViewControlsCreated(object sender, EventArgs e)
        {
            DetailView dv = View as DetailView;

            if (dv != null)
            {
                foreach (ViewItem w in dv.Items)
                {
                    DXPropertyEditor ww = w as DXPropertyEditor;
                    if (ww != null && ww.Control != null)
                    {
                        ww.Control.EnterMoveNextControl = true;
                    }
                }
            }

            StringPropertyEditor prd = dv.FindItem("PrdctCptr") as StringPropertyEditor;

            if (prd != null)
            {
                prd.Control.Validated += Control_Validated;
                prd.Control.KeyUp     += Control_KeyUp;
            }

            // Primero lo primero con el ratón
            LookupPropertyEditor prdl = dv.FindItem("Prdct") as LookupPropertyEditor;

            if (prdl != null)
            {
                prdl.Control.KeyUp      += Control_KeyUp1;
                prdl.Control.KeyPress   += Control_KeyPress;
                prdl.Control.KeyDown    += Control_KeyDown;
                prdl.Control.Validating += Control_Validating;
                prdl.Control.Validated  += Control_Validated1;
                prdl.Control.CloseUp    += Control_CloseUp;
                prdl.Control.Closed     += Control_Closed;
            }
        }