Client Size Wrong?

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
weswitt
Earned a small fee
Earned a small fee
Posts: 22
Joined: Thu Dec 29, 2016 10:45 pm

Client Size Wrong?

Post by weswitt » Tue Aug 11, 2020 5:37 pm

I'm seeing something very strange. I'm running on Ubuntu 20.04.

I'm creating a single wxFrame that is 800x480 in size. Inside the frame I have a single panel. I call GetClientSize on the frame and get the correct answer of 800x480. However it seems that the height of the client area is NOT 480 pixels. If I draw a line position 440 the line is nearly at the bottom of the window showing that the height is NOT 480 pixels. Is the frame height (client size) including the title bar? I tried to change the frame style and it had no effect.

Any ideas?

User avatar
doublemax
Moderator
Moderator
Posts: 15263
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Client Size Wrong?

Post by doublemax » Tue Aug 11, 2020 6:17 pm

I'm creating a single wxFrame that is 800x480 in size. Inside the frame I have a single panel. I call GetClientSize on the frame and get the correct answer of 800x480.
Something is wrong here. If you create a frame with 800x480, its client size must be smaller (unless you create a borderless frame without caption).

What happens if call SetClientSize(800x480) on the frame?
Use the source, Luke!

weswitt
Earned a small fee
Earned a small fee
Posts: 22
Joined: Thu Dec 29, 2016 10:45 pm

Re: Client Size Wrong?

Post by weswitt » Tue Aug 11, 2020 8:48 pm

thanks for the reply. the strange thing is that the client size is not consistent. i just rebuilt and installed 3.1.4 on kubuntu (instead of regular ubuntu). now i'm seeing that the first frame that i create has the right client size but subsequent frames are of the smaller size. i added a call to setclientsize and all seems to be good.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 4525
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Client Size Wrong?

Post by ONEEYEMAN » Tue Aug 11, 2020 10:25 pm

Hi,
Keep in mind that on GTK sizing is not available until the window is realized.

Now if you create a wxFrame with the wxSize( 800, 480 ) passed as the parameter to the constructor, it will be created as such. This size will include any borders you assign to the frame the title bar, the status bar and the menu (if you are not on Unity).
However in order to see that the frame is actually drawn.

Now when you draw the line, it will be drawn inside the client size, which smaller than the size of (800, 480).

All this is based on your own statement:
I'm creating a single wxFrame that is 800x480 in size.
This should be interpreted as "window size", not "client size".

Thank you.

Post Reply