Completed
Last Updated: 27 Nov 2014 14:58 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 06 Nov 2014 09:37
Category: Dock
Type: Bug Report
1
FIX. RadDock - ActiveWindowChanged event is not fired after clicking over a control inside the window
To reproduce: 
1. Add several DocumentWindows and ToolWindows to the RadDock. 
2. Add RadButton controls to the available windows. 
3. Subscribe to the ActiveWindowChanged event.
4. Run the application and click over the strip item of one ToolWindow. As a result the ActiveWindowChanged  event is fired. Click over the RadButton for a DocumentWindow. You will notice that the ActiveWindowChanged  event is not fired. 

Note: When the active DocumentWindow contains controls ,e.g. RadButton, the tab strip item is not bold.

Workaround:

static RadDock dock;

public Form1()
{
    InitializeComponent();
    dock = this.radDock1;
    Application.AddMessageFilter(new MyFilterClass());
}

public const int WM_LBUTTONDOWN = 0x0201;

public class MyFilterClass : IMessageFilter
{
    public bool PreFilterMessage(ref Message m)
    {
        if (m.Msg == WM_LBUTTONDOWN)
        {
            Point pt = dock.PointToClient(Cursor.Position);
        
            var clickedElement = dock.GetChildAtPoint(pt, GetChildAtPointSkip.Invisible) ;
            while (!(clickedElement is ToolWindow || clickedElement is DocumentWindow) && clickedElement != null)
            {
                ToolTabStrip tabStrip = clickedElement as ToolTabStrip;
                if (tabStrip != null)
                {
                    clickedElement = tabStrip.ActiveWindow;
                }
                else
                {
                    clickedElement = clickedElement.GetChildAtPoint(pt,  GetChildAtPointSkip.Invisible);
                }
            }

            if (clickedElement != null)
            {
                dock.ActiveWindow = clickedElement as DockWindow;
            }
        }
        return false;
    }
}

private void radDock1_ActiveWindowChanged(object sender, Telerik.WinControls.UI.Docking.DockWindowEventArgs e)
{
    e.DockWindow.TabStripItem.Font = new Font(e.DockWindow.TabStripItem.Font, FontStyle.Bold);
    
    foreach (DocumentWindow dw in this.radDock1.DockWindows.DocumentWindows)
    {
        if (dw.Name != e.DockWindow.Name)
        {
            dw.TabStripItem.Font = new Font(e.DockWindow.TabStripItem.Font, FontStyle.Regular);
        }
    }
}
0 comments