Eto ColorPicker not showing on some PC

Hi everyone,

I’m developing a plugin for Rhino 6 and I’m using Eto for the UI. I have a ColorPicker added to a DynamicLayout and in some workstations the control doesn’t show up at all. I’m running 6.31 version, but different PCs with same Rhino version works just fine, and others with older versions have the same problem

Any help? Thank you
Marco

Hi @m.camillo,

If “others” update to SR31, does their issue go away?

– Dale

Hi Dale,

seems the issue isn’t related to Rhino version. Different workstations with similar configurations and hardwares may have it or not.

Thanks, Marco

Hi @m.camillo,

Can you provide a code sample that isn’t working for your customers?

Thanks,

– Dale

Hi @dale,

I’m doing nothing different from usual, at least I think so.

  var errorColor = Settings.ErrorColor;
  m_errorColorPick = new ColorPicker() {
    Value = Color.FromArgb(errorColor.R, errorColor.G, errorColor.B)
  };

  m_errorLabel = new Label();

  var colorsLayout = new DynamicLayout();
  colorsLayout.Padding = new Padding(5);
  colorsLayout.BeginVertical(new Padding(5), new Size(5, 5));    
  colorsLayout.AddRow(m_errorColorPick, m_errorLabel);
  colorsLayout.EndVertical();

  var groupBox = new GroupBox() {
    Text = "Colors",
    Content = colorsLayout
  };

  return groupBox; 

Then the groupBox is set as Content of another layout.

Am I missing something?
Thanks,
Marco

Hey @m.camillo, thanks for the sample.

Do you see the GroupBox in your other layout? Also, it might be that you are adding that GroupBox to a scaled section, in which case resizing the panel might cause the control to be visible or not.

Hi @curtisw,

sorry, I could have thought to put a screen of the result. There should be three color picker to the left of the three labels, they are all initialized likewise and added to the same DynamicLayout. The dialog isn’t resizable but that doesn’t seems to affect the problem

immagine

thank you,
Marco

I am having the same issue on my machine after upgrading to Rhino 6R32. It was working before and now all the color pickers are gone.

In the end we implemented a custom color picker due to the unreliability of the Eto one.

internal class CustomColorPicker : EF.Button
  {
    private ED.Color m_color = ED.Color.FromArgb(0xFF, 0xFF, 0xFF);
    public ED.Color Value
    {
      get {
        return m_color;
      }

      set {
        if (m_color == value) {
          return;
        }

        m_color = value;
        BackgroundColor = m_color;
        ValueChanged?.Invoke(this, new EventArgs());
        Invalidate();
      }
    }

    public event EventHandler<EventArgs> ValueChanged;

    public CustomColorPicker()
    {
      BackgroundColor = ED.Color.FromArgb(0xFF, 0xFF, 0xFF);
      Click += OnButtonClicked;
    }

    protected override void OnShown(EventArgs e)
    {
      base.OnShown(e);
      BackgroundColor = m_color;
      Invalidate();
    }

    private void OnButtonClicked(object sender, EventArgs e)
    {
      var picker = new EF.ColorDialog();
      picker.Color = m_color;

      var originalColor = m_color;
      picker.ColorChanged += (s, args) => {
        Value = picker.Color;
      };

      var res = picker.ShowDialog(this);
      if (res == EF.DialogResult.Ok) {
        Value = picker.Color;
      } else {
        Value = originalColor;
      }

    }

  }
1 Like