Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent MouseEnter and MouseLeave behavior in GTK# #1884

Closed
bbb0x opened this issue Jan 31, 2021 · 0 comments · Fixed by #1900
Closed

Inconsistent MouseEnter and MouseLeave behavior in GTK# #1884

bbb0x opened this issue Jan 31, 2021 · 0 comments · Fixed by #1900
Labels
Milestone

Comments

@bbb0x
Copy link

bbb0x commented Jan 31, 2021

Expected Behavior

Background should be #dfdfdf as long mouse is over the Stacklayout, like it works with Windows and Mac.
2021-01-31 14-20-56_2

Actual Behavior

On GTK# the background flickers
li2021-01-31 14-20-56_3

Steps to Reproduce the Problem

  1. Hover the mouse over the Stacklayout wrapping the Content Editor button

Code that Demonstrates the Problem

     void InitializeComponent()
        {
            Title = "GM Kickout";
            MinimumSize = new Size(200, 200);
            Size = new Size(600, 300);
            var root  = new DynamicLayout();
            root.BackgroundColor = Colors.White;

            var header = new DynamicLayout();
            header.Height = 70;
            header.BackgroundColor = Color.FromRgb(0x008080);

            root.Add(header);

            var content = new DynamicLayout();
            content.Padding = new Padding(0, 20, 0, 0);
           

            var layout1 = MainLayout.CreateMainContentItem("Content Editor", "Edit the Content files of the project.", null);
            content.Add(layout1);
            root.Add(content);
	    Content = root;

            Focus();
	}
			
			
			
			
public static class MainLayout
{
        public static DynamicLayout CreateMainContentItem(string title, string description, Action click)
        {
            DynamicLayout layout = new DynamicLayout();
            
            StackLayout stackLayout = new StackLayout();
            stackLayout.Orientation = Orientation.Vertical;
            stackLayout.Padding = new Padding(0, 10);
            stackLayout.HorizontalContentAlignment = HorizontalAlignment.Center;
            stackLayout.MouseEnter += ((e, o) =>
            {
                stackLayout.BackgroundColor = Color.FromRgb(0xdfdfdf);
            });
            stackLayout.MouseDown += ((e, o) =>
            {
                stackLayout.BackgroundColor = Color.FromRgb(0x008080);
                if(click != null)
                click();
            });
            stackLayout.MouseLeave += ((e, o) =>
            {
                stackLayout.BackgroundColor = SystemColors.ControlBackground;
            });

            Label titleLbl = new Label();
            titleLbl.TextColor = Color.FromRgb(0xf88379);
            titleLbl.Font = new Font(SystemFont.Label, 20f);
            titleLbl.Text = title;

            Label descriptionLbl = new Label();
            descriptionLbl.Font = new Font(SystemFont.Label);
            descriptionLbl.Text = description;

            stackLayout.Items.Add(titleLbl);
            stackLayout.Items.Add(descriptionLbl);

            StackLayout dummy = new StackLayout();
            layout.Add(stackLayout);
            layout.Add(dummy);

            return layout;
        }

}

Specifications

  • Version: 2.59
  • Platform(s): Windows example using WPF, Linux example using GTK#
  • Operating System(s): Windows 10 | Ubuntu 20.04.2 LTS as a VirtualBox guest under Windows 10.

Also tested on macOS Mojave with Mac inside VirtualBox which results in the same behavior as on Windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants