Eto TabControl in panel not reacting to mouse clicks

Hello,

I try to develop a panel for our plugin, which consists of a TabControl with 2 pages. Then I attach the panel to the Right Container. Developed in C# using the Eto Forms, and tested on Windows Rhino 8

Initially the TabControl works fine, but as soon as I click in one of the Rhino viewports, and then go back with the mouse to the panel, the TabControl no longer reacts when I click on the tabs. I can no longer switch between the Left and the Right page.

Any suggestion how to solve this ?

The panel is registered on the plugin OnLoad
Rhino.UI.Panels.RegisterPanel(this, typeof(TestPanel), "Test panel", Assembly, Rhino.UI.PanelType.PerDoc);

For demonstration I reduced to panel to its bare minimum in this code :

using Eto.Forms;
using Rhino.UI;
using Rhino;
[Guid(“91437940-5547-4324-9A55-FE7D0EA5F597”)]
public class TestPanel : TabControl
{
public static System.Guid PanelId
{
get
{
return typeof(TestPanel).GUID;
}
}
public TestPanel(RhinoDoc doc)
{
Pages.Add(new TabPage { Text = “Left”, Content = new Panel() });
Pages.Add(new TabPage { Text = “Right”, Content = new Panel() });
SelectedIndexChanged += this.TabControl_Selected;
}
private void TabControl_Selected(object sender, EventArgs e)
{
RhinoApp.WriteLine(SelectedPage.Text);
}
}

I have the same identical problem - you had any luck in finding the solution?

Hi @Sven_Duplić,

The class you register with Panels.RegisterPanel is the control Rhino sites in the panel container. Rather than deriving that class from TabControl, derive it from Eto.Forms.Panel and make the tab control its Content:

[System.Runtime.InteropServices.Guid("17F62218-B7F9-4A1E-B096-597FBAE55961")]
public class TestPanel : Panel, IPanel
{
  private readonly TabControl m_tabs;

  public static System.Guid PanelId => typeof(TestPanel).GUID;

  public TestPanel(uint documentSerialNumber)
  {
    m_tabs = new TabControl { TabPosition = DockPosition.Top };
    m_tabs.Pages.Add(new TabPage { Text = "Left", Content = new Panel() });
    m_tabs.Pages.Add(new TabPage { Text = "Right", Content = new Panel() });
    m_tabs.SelectedIndexChanged += OnSelectedIndexChanged;

    Content = m_tabs;
  }

  // ...
}

A working sample can be found on GitHub:

Hope this helps,

– Dale

Worked for me. I’ve also managed to do it with a custom mouse up event on the TabPage, like this:

tab.MouseUp += (s, e) => {
if (TabPagesControl.SelectedPage != tab)
TabPagesControl.SelectedPage = tab;
};