Custom Toolwindow and other operations with RadDock

5 posts, 0 answers
  1. shinu rag
    shinu rag avatar
    48 posts
    Member since:
    Feb 2010

    Posted 29 Apr 2010 Link to this post

    hii
    am in  trouble. here i need your help . am attached my sample application with this post..please chek it ..
    this form have 4 custome tool windows when doule click on its title bar its working ok with my requirements.. but when i close any one of the tool window, i need to restore these windows in old state.. but i can't do it.. please help.......,.
  2. Julian Benkov
    Admin
    Julian Benkov avatar
    1135 posts

    Posted 06 May 2010 Link to this post

    Hello shinu rag,

    Please, carefully review the UI layer of your application. In this case, after every resize operation of the selected Form, the Dock state of all Forms will change. This may result in confusion for the end-user of your application since the UI layout will unexpectedly become different.

    You can send us a screenshot with what you want to achieve as a final UI structure for your project . We will try to find the best solution for your scenario and help you build it.

    Thanks for your time. We look forward to receiving the requested details.

    All the best,
    Julian Benkov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. shinu rag
    shinu rag avatar
    48 posts
    Member since:
    Feb 2010

    Posted 06 May 2010 Link to this post

    hi....
    Julian Benkov

    Here is the detailed info..
    am attatched 2 pictures with this post.

    i think the end-user may not in a confusion when layout will unexpectedly become different. because in the 4 different sub windows, they want to maximize one of the window from these... that time all windows dockstate changed like Picture 2, after this they may need to restore these windows in its old state(Picture 1)...

    Picture 1. First Layout ( 4 custom windows),
    that is :-
    frm1 = new Scheduler();
     frm2 = new RadForm();
     frm3 = new RadForm();
     frm4 = new RadForm();

     when i double click on any of the window's title bar these windows are align like picture 2,
    from the picture 2 layout, am trying to close any of the form(Scheduler,My Form2,My Form3,My Form4)  these forms are keep their layout like picture 1...

    how cai i implement these operations..
  5. Julian Benkov
    Admin
    Julian Benkov avatar
    1135 posts

    Posted 12 May 2010 Link to this post

    Hi shinu rag,

    This functionality is suitable for a TileView control. We may consider developing a new control with similar behavior for a future edition of RadControls. I made minor changes to your example to support this scenario, but this is not the normal and native behavior of RadDock:

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    using Telerik.WinControls;
    using Telerik.WinControls.UI;
    using Telerik.WinControls.UI.Docking;
    using System.IO;
     
    namespace SampleAppln
    {
        public partial class Sample : Telerik.WinControls.UI.RadForm
        {
            EventHandler han;
     
            RadForm frm1;// = new Form();
            RadForm frm2;// = new Form();
            RadForm frm3;// = new Form();
            RadForm frm4;// = new Form();
     
            public Sample()
            {
                InitializeComponent();
     
                //frm1 = new SchedulerForm();
                //frm2 = new frmPatientsMaster();
                //frm3 = new frmPatientsMaster();
                //frm4 = new SchedulerForm();
     
                //this.radDock1.AutoDetectMdiChildren = true;
                //this.radDock1.MdiChildrenDockType = Telerik.WinControls.UI.Docking.DockType.ToolWindow;
            }
     
            private void sample_Load(object sender, EventArgs e)
            {
                han = new EventHandler(sample_Resize);
                listBox1.Items.Add("Load");
                //frm1.Resize += han;
                //frm2.Resize += han;
                //frm3.Resize += han;
                //frm4.Resize += han;
     
                this.radDock1.MainDocumentContainerVisible = false;
     
                frm1 = new RadForm();
                frm2 = new RadForm();
                frm3 = new RadForm();
                frm4 = new RadForm();
     
                frm1.BackColor = Color.Pink;
                frm1.Text = "Scheduler";
                frm1.Select();
                HostWindow window = this.radDock1.DockControl(frm1, DockPosition.Top);
                window.ToolCaptionButtons = ToolStripCaptionButtons.AutoHide;         
     
                frm2.BackColor = Color.Pink;
                frm2.Text = "My Form2";
                frm2.Select();
                this.radDock1.DockControl(frm2, window, DockPosition.Right).ToolCaptionButtons = ToolStripCaptionButtons.AutoHide;
     
                frm3.BackColor = Color.Pink;
                frm3.Text = "My Form3";
                frm3.Select();
                window =  this.radDock1.DockControl(frm3, DockPosition.Bottom);
                window.ToolCaptionButtons = ToolStripCaptionButtons.AutoHide;
     
                frm4.BackColor = Color.Pink;
                frm4.Text = "My Form4";
                frm4.Select();
                this.radDock1.DockControl(frm4, window, DockPosition.Right).ToolCaptionButtons = ToolStripCaptionButtons.AutoHide;
     
                frm1.Resize += han;
                frm2.Resize += han;
                frm3.Resize += han;
                frm4.Resize += han;
                
            }
     
            private void radDock1_DockWindowClosed(object sender, DockWindowEventArgs e)
            {
                listBox1.Items.Add("Closed " + e.DockWindow.Text + " " + e.DockWindow.DockType.ToString());
     
                if (e.DockWindow.DockType == DockType.ToolWindow)
                    return;
                DockWindowEventHandler handler = new DockWindowEventHandler(radDock1_DockWindowClosed);
                radDock1.DockWindowClosed -= handler;
                radDock1.RemoveAllWindows(DockWindowCloseAction.CloseAndDispose);
                sample_Load(sender, e);
     
                //radDock1.DockWindowClosed += handler;
            }
     
            private void sample_Resize(object sender, EventArgs e)
            {
                RadForm frm = (RadForm)sender;
                if (frm.Text != "sample")
                {              
                    foreach (HostWindow hw in radDock1.DockWindows)
                    {
                        if (hw.DockState == DockState.Floating)
                        {
                            listBox1.Items.Add("Resize " + hw.Text + " " + hw.DockState.ToString());
     
                            DockWindowEventHandler handler = new DockWindowEventHandler(radDock1_DockWindowClosed);
                            radDock1.DockWindowClosed -= handler;
     
                            frm1.Resize -= han;
                            frm2.Resize -= han;
                            frm3.Resize -= han;
                            frm4.Resize -= han;
     
                            this.radDock1.MainDocumentContainerVisible = true;
                            radDock1.RemoveAllWindows();
                            radDock1.DockControl(frm1, DockPosition.Fill, DockType.Document);
                            radDock1.DockControl(frm2, DockPosition.Fill, DockType.Document);
                            radDock1.DockControl(frm3, DockPosition.Fill, DockType.Document);
                            radDock1.DockControl(frm4, DockPosition.Fill, DockType.Document);
     
                            radDock1.ActivateWindow(hw);
     
                            radDock1.DockWindowClosed += handler;
                            return;
                        }
                    }
                }
            }
     
            private void button1_Click(object sender, EventArgs e)
            {
                listBox1.Items.Clear();
            }
        }
    }

     

    All the best,
    Julian Benkov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  6. shinu rag
    shinu rag avatar
    48 posts
    Member since:
    Feb 2010

    Posted 12 May 2010 Link to this post

    hi..
    Julian Benkov
    its working fine thanks alot...
    but
    in the sample_Resize event
    radDock1.ActivateWindow(hw);
     not working fine... every time focus on  "My Form4"..
    its ok i will try it....



Back to Top
UI for WinForms is Visual Studio 2017 Ready