wxWindow does not resize

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
sbVB
In need of some credit
In need of some credit
Posts: 8
Joined: Thu Sep 07, 2006 3:03 am
Location: Rio de Janeiro
Contact:

wxWindow does not resize

Post by sbVB » Sun Mar 03, 2013 3:48 pm

Hi all,

I am running wxWidgets 2.8.12 on Linux 12.10, 64 bits.

I am trying to resize a non modal wxFrame, opened from a parent wxFrame.
I want the child wxFrame to be resized by clicking 2 buttons ("plus" and "minus") on the parent wxFrame.
I mapped the 2 buttons on the parent, and wrote code as below.

void ChildFrame::plus() {
m_width += 30;
refresh();
}

void ChildFrame::minus() {
m_width -= 30;
refresh();
}

void ChildFrame::refresh() {
m_height = m_width / 4.0 * 3.0; // fixed proportion
wxSize newSize(m_width,m_height);
SetSize(newSize);
Show(TRUE);
Refresh(false);
}

I click the buttons, but the child wxFrame does not get resized.
What am I doing wrong ?

Thanks in advance.

----------------------------------------------------
+------+ Sergio Barbosa Villas-Boas
/------/| [email protected]
| sbVB |/ http://www.sbVB.com.br
+------+ +55-21-7699-1337
----------------------------------------------------
+------+ Sergio Barbosa Villas-Boas
/------/| [email protected]
| sbVB |/ http://www.sbVB.com.br
+------+ Skype: sbvbsbvb

Radek
Super wx Problem Solver
Super wx Problem Solver
Posts: 286
Joined: Sun Sep 11, 2011 7:17 am

Re: wxWindow does not resize

Post by Radek » Sun Mar 03, 2013 4:30 pm

It is not clear from the post whether the buttons are connected to ChildFrame::plus() and ChildFrame::minus() correctly. Run the debugger and set breaks in plus() and minus(). Click the buttons. Do you break in the handlers? If so then the buttons are connected correctly. Is the value m_width the current value of the width of the ChildFrame? If it is not then you are probably resizing something else. Next, you need not call Show() in refresh() if the ChildFrame is already shown on the screen. SetSize() and Refresh() should be enough.

sbVB
In need of some credit
In need of some credit
Posts: 8
Joined: Thu Sep 07, 2006 3:03 am
Location: Rio de Janeiro
Contact:

Re: wxWindow does not resize

Post by sbVB » Sun Mar 03, 2013 7:21 pm

I did not write the complete code.
In my computer, I added some debug code,
and I am absolutely sure that:
*) the buttons are adequately mapped.
*) the methods are being called when the buttons are pressed.
*) the values of m_width and m_height are correct before calling SetSize

The thing is that I am calling SetSize of an existing wxFrame
with proper values, but the frame does not resize.

sbVB
----------------------------------------------------
+------+ Sergio Barbosa Villas-Boas
/------/| [email protected]
| sbVB |/ http://www.sbVB.com.br
+------+ Skype: sbvbsbvb

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

Re: wxWindow does not resize

Post by doublemax » Sun Mar 03, 2013 7:36 pm

Linux 12.10, 64 bits
Is that Ubuntu? If yes, this could be one of the many Ubuntu oddities. Ubuntu breaks a lot of things in wxWidgets, 2.9.4 has a few fixes and workarounds, so you should try that.
Use the source, Luke!

sbVB
In need of some credit
In need of some credit
Posts: 8
Joined: Thu Sep 07, 2006 3:03 am
Location: Rio de Janeiro
Contact:

Re: wxWindow does not resize

Post by sbVB » Sun Mar 03, 2013 9:22 pm

I upgraded to wx 2.9.4, and the problem was fixed !!! :)
----------------------------------------------------
+------+ Sergio Barbosa Villas-Boas
/------/| [email protected]
| sbVB |/ http://www.sbVB.com.br
+------+ Skype: sbvbsbvb

Post Reply