This is a migrated thread and some comments may be shown as answers.

Prevent Duplicate Windows

4 Answers 118 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Ramachandran
Top achievements
Rank 1
Ramachandran asked on 21 Jul 2017, 06:00 AM

 

 

    I have three forms .In the form Button Exit Click form is closed but the  Data is not initializing in the Text Box and Gridview.

4 Answers, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 21 Jul 2017, 08:20 AM
Hi Ramachandran,

Thank you for writing.

I am not sure what the nature of your issue is and how it can be reproduced. Can you please provide us more details about your actual scenario? A code snippet and a short video showing the behavior on your end would also help.

Looking forward to your reply.

Regards,
Hristo
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Ramachandran
Top achievements
Rank 1
answered on 22 Jul 2017, 05:49 AM
Hi Hristo

Thanks for your reply.

Herewith i am attaching a video for your understanding.

I am using RadDock and Rad Forms. I am calling the form in RadDock using this code. 

1. I want to prevent the same form should not be loaded. and working not full.
2. When i close and double click on the treeview the form is opened with the same values
when i hav closed. all the data and grid details remains in the control.

I tried this.close, this.parent.close all methods still the problem persist. 

Please help in how to prevent the same form should not be called and varibles should
initialise.

I tried the below code. Expecting your reply at the earliest.

Thanks and Regards


   frmCustomerEnquiry frmCustEnquiry = new frmCustomerEnquiry(strTheme, dtUserRights);
   DisplayForm(frmCustEnquiry);

   private void DisplayForm(System.Windows.Forms.Form form)
        {

            bool blnFormExists;
            blnFormExists = false;

            this.Cursor = Cursors.WaitCursor;

            foreach (Form form1 in DockEnquiry.MdiChildren)
            {
                if (form1.GetType() == form.GetType())
                {
                    DockEnquiry.ActivateMdiChild(form1);
                    blnFormExists = true;
                    break;

                }
            }
            if (blnFormExists == true)
            {
            }
            else
            {
                form.MdiParent = this;
               // DockEnquiry.close
                form.Show();

                Telerik.WinControls.UI.Docking.HostWindow host = (Telerik.WinControls.UI.Docking.HostWindow)form.Parent;
                DockEnquiry.ActivateWindow(host);
            }

            form.Focus();
            this.Cursor = Cursors.Default;
        }
0
Ramachandran
Top achievements
Rank 1
answered on 22 Jul 2017, 05:50 AM
Hi Hristo

Thanks for your reply.

Herewith i am attaching a video for your understanding.

I am using RadDock and Rad Forms. I am calling the form in RadDock using this code. 

1. I want to prevent the same form should not be loaded. and working not full.
2. When i close and double click on the treeview the form is opened with the same values
when i hav closed. all the data and grid details remains in the control.

I tried this.close, this.parent.close all methods still the problem persist. 

Please help in how to prevent the same form should not be called and varibles should
initialise.

I tried the below code. Expecting your reply at the earliest.

Thanks and Regards


   frmCustomerEnquiry frmCustEnquiry = new frmCustomerEnquiry(strTheme, dtUserRights);
   DisplayForm(frmCustEnquiry);

   private void DisplayForm(System.Windows.Forms.Form form)
        {

            bool blnFormExists;
            blnFormExists = false;

            this.Cursor = Cursors.WaitCursor;

            foreach (Form form1 in DockEnquiry.MdiChildren)
            {
                if (form1.GetType() == form.GetType())
                {
                    DockEnquiry.ActivateMdiChild(form1);
                    blnFormExists = true;
                    break;

                }
            }
            if (blnFormExists == true)
            {
            }
            else
            {
                form.MdiParent = this;
               // DockEnquiry.close
                form.Show();

                Telerik.WinControls.UI.Docking.HostWindow host = (Telerik.WinControls.UI.Docking.HostWindow)form.Parent;
                DockEnquiry.ActivateWindow(host);
            }

            form.Focus();
            this.Cursor = Cursors.Default;
        }
0
Dimitar
Telerik team
answered on 24 Jul 2017, 09:03 AM
Hello Ramachandran,

I have tested this on my side and it works as expected (I have attached my test project).

In addition, the following article shows how this can be achieved as well: Docking Singleton Forms.

I hope this is useful.

Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Dock
Asked by
Ramachandran
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Ramachandran
Top achievements
Rank 1
Dimitar
Telerik team
Share this question
or