picoe / Eto

Cross platform GUI framework for desktop and mobile applications in .NET
Other
3.57k stars 325 forks source link

[GTK] Controls in Expander.Header cannot get focus. #1111

Open SlowLogicBoy opened 6 years ago

SlowLogicBoy commented 6 years ago

Expected Behavior

Expander.Header.Focus() triggered. expander 1

Actual Behavior

Expander.Header.Focus() not triggered. expander

Steps to Reproduce the Problem

  1. Run Code Below

Code that Demonstrates the Problem

#! "netcoreapp2.0"
#r "nuget: Eto.Platform.Gtk, *"

using Eto.Drawing;
using Eto.Forms;

var app = new Application(new Eto.GtkSharp.Platform());
var expander = new Expander {
    Header = new TextBox(),
    Content = "Woot?"
};
app.Run(new Form {
    Content = expander
});

Workaround

expander.MouseUp += (s, ee) => {
    if(expander.Header.Bounds.Contains(new Point(ee.Location)))
    {
        expander.Header.Focus();
        ee.Handled = true;
    }
};

Specifications

Note

Wpf works as expected.

cwensley commented 6 years ago

Thanks for reporting the issue! Not sure if that is actually supported by Gtk, but it's worth checking into.

Can you tab to the control with the keyboard? If so it might just be the click event that needs overriding.

harry-cpp commented 6 years ago

I think the problem here is the fact that Eto does not provide a SetExpanded(bool) function, which btw. is totally possible with Gtk: https://developer.gnome.org/gtk3/stable/GtkExpander.html#gtk-expander-set-expanded

harry-cpp commented 6 years ago

Oh wait, I misunderstood the issue..

SlowLogicBoy commented 6 years ago

Can you tab to the control with the keyboard?

Yes I can.