Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Dock > Focus floating toolwindow on form load

Answered Focus floating toolwindow on form load

Feed from this thread
  • Arun Kumar avatar

    Posted on Nov 27, 2011 (permalink)

    How do I focus control inside toolwindow on form load ?

    Reply

  • Julian Benkov Julian Benkov admin's avatar

    Posted on Nov 30, 2011 (permalink)

    Hi Arun Kumar,

    To focus a child control in ToolWindow or any parent window, you must call Focus method in the Load event. Here is a simple example:

    public partial class DockForm5 : Form
    {
        private TextBox textBox;
     
        public DockForm5()
        {
            InitializeComponent();
     
            ToolWindow tool = new ToolWindow("123");
            
            ComboBox box = new ComboBox();
            box.Items.Add("1");
            box.Items.Add("2");
            box.Items.Add("3");
            tool.Controls.Add(box);
     
            RadDropDownList list = new RadDropDownList();
            list.Items.Add("1");
            list.Items.Add("2");
            list.Items.Add("3");
            list.Location = new Point(50, 50);
            tool.Controls.Add(list);
     
            RadDateTimePicker picker = new RadDateTimePicker();
            picker.Location = new Point(50, 90);
            tool.Controls.Add(picker);
            radDock1.DockWindow(tool, DockPosition.Left);
     
            tool = new ToolWindow("333");
            textBox = new TextBox();
            tool.Controls.Add(textBox);
     
            radDock1.DockWindow(tool, DockPosition.Bottom);
            radDock1.AddDocument(new DocumentWindow("test"));
        }
     
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
     
            textBox.Focus();
        }
    }

    I hopo this helps.

    All the best,
    Julian Benkov
    the Telerik team

    Q3’11 of RadControls for WinForms is available for download (see what's new). Get it today.

    Reply

  • Arun Kumar avatar

    Posted on Dec 3, 2011 (permalink)

    Hi Julian Benkov,

    Thanks for your reply.

    I have floating toolwindow. In form load event, I use the RadDock.FloatWindow method to show the toolwindow. It shows the window on form load but it is not focused. Only if I click the window it gets activated. I want the window activated by default. So I can focus the textbox placed inside the toolwindow. How do I do that ? 


    Reply

  • Answer Julian Benkov Julian Benkov admin's avatar

    Posted on Dec 7, 2011 (permalink)

    Hello Arun,

    For this functionality you can use the Shown event of From instead of the Load event. Here is a simple example:

    protected override void OnShown(EventArgs e)
    {
        base.OnShown(e);
     
        radDock1.FloatWindow(toolWindow);
        toolWindow.FloatingParent.Activate();
    }

    Let me know if you need further assistance.

    All the best,
    Julian Benkov
    the Telerik team

    Q3’11 of RadControls for WinForms is available for download (see what's new). Get it today.

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Dock > Focus floating toolwindow on form load
Related resources for "Focus floating toolwindow on form load"

[ Features | Demos | Documentation | Knowledge Base | Telerik TV | Code Library | Step-by-step Tutorial | Blogs | Self-Paced Trainer ]