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

AcceptButton + CancelButton support in UserDockControl?

4 Answers 64 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Ben
Top achievements
Rank 1
Ben asked on 05 May 2009, 02:27 AM
Hi,

I have an application with multiple docked/tabbed panels. I also launch some panels as floating windows. All my panels derive from UserDockControl.

On certain panels I have OK/Cancel buttons which commit changes to the database, or cancel them. I would like to implement support for firing these buttons if/when the user hits Enter/Esc on their keyboard.

This is handled in normal WinForms via the AcceptButton and CancelButton properties of a Form. I see these properties exist for UserDockForm as well, however if I try deriving my panels from UserDockForm I get behaviour I am not happy with - i.e. I can't seem to launch the panels as floating.

Is there a way to implement the AcceptButton/CancelButton support in a panel derived from UserDockControl? 

What is the difference between UserDockControl and UserDockForm?

Thanks in advance,
Ben

4 Answers, 1 is accepted

Sort by
0
Julian Benkov
Telerik team
answered on 07 May 2009, 09:55 AM
Hi Ben,

This functionality is not automatically managed for current version of DockingManager component. This is a good idea and we have logged it for research and possible implementation in the new RadDock component.

To support this behavior in floating mode you can try this snippet:

UserDockForm dockPanel = new UserDockForm(); 
this.dockingManager1.SetDock(dockPanel, DockPosition.Left); 
this.dockingManager1.Float(dockPanel); 
 
if (dockPanel.DockingSite.HostForm != null
    dockPanel.DockingSite.HostForm.AcceptButton = dockPanel.AcceptButton; 
    dockPanel.DockingSite.HostForm.CancelButton = dockPanel.CancelButton; 

The difference between UserDockForm and UserDockControl is only in the base class corresponding to Form and UserControl objects.

Regards,
Julian Benkov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Ben
Top achievements
Rank 1
answered on 08 May 2009, 04:24 AM
Thanks Julian - that has done the trick!
0
Ben
Top achievements
Rank 1
answered on 07 Jul 2009, 12:39 AM
I have just downloaded the 2009 Q2 update and am trying to update my existing code. I can't find a way to implement this functionality in the new controls. Can you advise how I set the Accept and Cancel buttons?
0
Accepted
Julian Benkov
Telerik team
answered on 07 Jul 2009, 10:02 AM
Hello Ben,

For the new RadDock component, you can use following snippet:

Form myForm = new Form(); 
HostWindow hostWindow = radDock1.DockControl(myForm, (DockWindow)null, DockPosition.Left);  //for Q2 2009 SP1 release can use also 'radDock1.DockControl(myForm, DockPosition.Left)' 
radDock1.FloatWindow(hostWindow); 
myForm.Show();      //this will be not needed for Q2 2009 SP1 release 
 
if (hostWindow.FloatingParent != null
    hostWindow.FloatingParent.AcceptButton = ((Form)hostWindow.Content).AcceptButton; 
    hostWindow.FloatingParent.CancelButton = ((Form)hostWindow.Content).CancelButton; 
}  

Best wishes,
Julian Benkov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Dock
Asked by
Ben
Top achievements
Rank 1
Answers by
Julian Benkov
Telerik team
Ben
Top achievements
Rank 1
Share this question
or