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

Controls are resized after adding them to PixelLayout (using Gtk3) #1887

Closed
borjafdezgauna opened this issue Feb 2, 2021 · 4 comments
Closed
Milestone

Comments

@borjafdezgauna
Copy link

Expected Behavior

I would have expected controls to keep their sizes after being added to a PixelLayout.

Actual Behavior

Unlike using Wpf or Mac64 implementations, when I add a control to a PixelLayout using Gtk, the control is resized with a new size (usually 1,1).

Steps to Reproduce the Problem

  1. Create a pixel layout
  2. Add a control to it using Add()
  3. Check the size of the control after that

Code that Demonstrates the Problem

            PixelLayout pixelLayout = new PixelLayout();
            pixelLayout.Size = new Size(windowSizeInPixelsX, windowSizeInPixelsY);
            Panel panel = new Panel() {Size = new Size(pixelLayout.Width / 2, pixelLayout.Height / 2)};
            pixelLayout.Add(panel,50, 50);

Specifications

  • Version: 2.5.10
  • Platform(s): Gtk3
  • Operating System(s): Windows 10, Ubuntu 20.04 TLS

I have had a look at the PixelLayout handler for Gtk and I suspect this is a known issue (there is a comment saying that the minimum size is used instead of the natural size), but haven't found any issue so I thought I'd better report it just in case :)

@cwensley
Copy link
Member

cwensley commented Feb 2, 2021

Hey @borjafdezgauna,

Thanks for reporting the issue and providing a code sample to demonstrate the problem. There is another known issue (#1752) that might be related to this one, but it'll need some digging.

@cwensley cwensley added this to the 2.5.x milestone Feb 2, 2021
@cwensley
Copy link
Member

I can't seem to reproduce this with this code:

	public class TestForm : Form
	{
		public TestForm()
		{
			PixelLayout pixelLayout = new PixelLayout();
			pixelLayout.Size = new Size(200, 200);
			Panel panel = new Panel() { Size = new Size(pixelLayout.Width / 2, pixelLayout.Height / 2), BackgroundColor = Colors.Blue };
			pixelLayout.Add(panel, 50, 50);
			Content = pixelLayout;
		}
	}

Perhaps you're doing something different?

I also fixed another issue relating to this with #2196, but with or without that change the above still works for me.

Could you test with the latest code to see if it's still happening for you?

@cwensley cwensley modified the milestones: 2.6.x, 2.x Apr 24, 2022
@borjafdezgauna
Copy link
Author

I have tested the code above on Ubuntu 20, and can confirm that panel shows properly. I am quite sure I actually ran that same code when I created the issue, but hey... I could be wrong

Thanks anyway, Curtis!!

@cwensley
Copy link
Member

@borjafdezgauna thanks for the quick response and testing that out. I'll close the issue but if you happen to see it again let me know.

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

No branches or pull requests

2 participants