It's been a long time since I last did GUI stuff myself, but I do remember that before creating a window you can set its parameters to be not resizable. I'm pretty sure you cannot do this after the window is created, so you'll have to check the documentation on the
Create()
function (or however it's called).
With regard to the second problem, each of the two tabs is a child of the parent window. The parent does know all of its children, but the children do not know of their siblings, and they only got a pointer to their parent whose type is anonymized as
CWnd*
, so they don't know about any special functions that your actual parent window class may possess.
One clean way to solve this would be to use a callback mechanism. Here is a short outline of what you need to do:
class IButtonCallback {
public:
virtual void OnForm2Button1Pressed() = 0;
};
#include "IButtonCallback.h"
class MainWnd : public CWnd, IButtonCallback {
void OnForm2Button1Pressed();
};
MainWnd::MainWnd() {
form2.SetCallback(this);
}
void MainWnd::OnForm2Button1Pressed() {
form1.SetText(_T("Button pressed!"));
}
class Form1 : public CWnd {
void SetText(TCHAR* text);
};
#include "IButtonCallback.h"
class Form2 : public CWnd {
void SetCallback(IButtonCallback* cb);
void OnButtonPressed();
private:
IButtonCallback* m_cb;
};
void Forms::SetCallback(IButtonCallback* cb) {
m_cb = cb;
}
void Form2::OnButtonPressed() {
m_cb->OnForm2Button1Pressed();
}