Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
335
Copy Paste Cut operation on controls on MdiChildForm
posted

hi all,

I need to implement Copy, Paste, Cut operations (main tool menu item) on WinGrid cells or textboxes, which are placed on nested container controls on MdiChildForms.    

this.ActiveControl  always give the highest level MdiChildForm  instead of the actual grid or textbox that I selected.    How do I get the real active control so that I can do something like grid..PerformAction(UltraGridAction.Copy)   or textBox.Copy( )??

Thanks in advance

 

Parents
No Data
Reply
  • 37774
    Suggested Answer
    posted

    I would think that you have to continue walking down the control hiearchy looking for the active control; this property is on ContainerControl, so you would also have to check for that.

    UltraGrid activeGrid = null;
    ContainerControl container = this.ActiveControl as ContainerControl;
    while (container != null)
    {
        Control activeControl = container.ActiveControl;
        if (activeControl is UltraGrid)
        {
            activeGrid = (UltraGrid)activeControl;
            break;
        }

        container = activeControl as ContainerControl;
    }

    -Matt

Children
No Data