I have a wxScrolledWindow (Base) as a base and in this I have a wxBoxSizer in the BoxSizer I have two wxScrolledWindow (Win1 and Win2).
That works fine. But if I like to change the size of the Win1 the wxSizer does not Recalc the size.
See the examples below.
This is the source for the Base:
Code: Select all
coMyTable::coMyTable(wxWindow *wParent, wxWindowID id, long lStyle)
: wxScrolledWindow(wParent, id, wxDefaultPosition, wxDefaultSize, lStyle)
, csMyTableData(){
m_szrTop = new wxBoxSizer(wxVERTICAL);
SetSizer(m_szrTop);
m_szrTop->Add(m_mtlLabel = new coMyTableLabel(this, ID_LABEL, this), 0, wxALL | wxEXPAND, 0);
m_szrTop->Add(m_mtbBody = new coMyTableBody(this, ID_BODY, this), 1, wxALL | wxEXPAND, 0);
}
coMyTable::~coMyTable(){}
void coMyTable::SetLabelHeight(int iHeight){
m_mtlLabel->SetSize(m_mtlLabel->GetSize().GetWidth(), iHeight);
// m_mtlLabel->Refresh();
//m_szrTop->RecalcSizes();
//FitInside();
}
Code: Select all
#include "coMyTableLabel.h"
BEGIN_EVENT_TABLE(coMyTableLabel, wxScrolledWindow)
EVT_PAINT(coMyTableLabel::OnPaint)
EVT_ERASE_BACKGROUND(coMyTableLabel::OnEraseBackground)
EVT_MOUSE_EVENTS(coMyTableLabel::OnMouseEvent)
//EVT_SIZE(coMyTableLabel::OnSize)
END_EVENT_TABLE()
coMyTableLabel::coMyTableLabel(wxWindow *wnd, wxWindowID id, csMyTableData *dt)
: wxScrolledWindow(wnd, id, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE){
m_dt = dt;
SetAutoLayout(true);
}
coMyTableLabel::~coMyTableLabel(){}
// ** E V E N T S ***
void coMyTableLabel::OnEraseBackground(wxEraseEvent& event){}
void coMyTableLabel::OnPaint(wxPaintEvent &event){
wxBufferedPaintDC dc(this);
PrepareDC(dc);
dc.SetFont(GetFont());
dc.SetBackground(wxBrush(wxColour("#ffffff"), wxSOLID));
dc.Clear();
m_dt->DrawLabel(dc, GetSize());
}
void coMyTableLabel::OnMouseEvent(wxMouseEvent &event){
/*wxString sCursor = "default";
m_data->OnMouseEventLabel(event, sCursor);
if(sCursor == "default"){
wxScrolledWindow::SetCursor(*wxSTANDARD_CURSOR);
}else if(sCursor == "sizewe"){
wxScrolledWindow::SetCursor(wxCursor(wxCURSOR_SIZEWE));
}
Refresh();*/
}
void coMyTableLabel::OnSize(wxSizeEvent &event){
Layout();
}
Code: Select all
#include "coMyTableBody.h"
BEGIN_EVENT_TABLE(coMyTableBody, wxScrolledWindow)
EVT_PAINT(coMyTableBody::OnPaint)
EVT_ERASE_BACKGROUND(coMyTableBody::OnEraseBackground)
//EVT_MOUSE_EVENTS(coMyTableBody::OnMouseEvent)
END_EVENT_TABLE()
coMyTableBody::coMyTableBody(wxWindow *wnd, wxWindowID id, csMyTableData *dt)
: wxScrolledWindow(wnd, id, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE){
m_dt = dt;
wxScrolledWindow::SetScrollRate(1, 1);
}
coMyTableBody::~coMyTableBody(){}
// ** E V E N T S ***
void coMyTableBody::OnEraseBackground(wxEraseEvent& event){}
void coMyTableBody::OnPaint(wxPaintEvent &event){
wxBufferedPaintDC dc(this);
PrepareDC(dc);
dc.SetFont(GetFont());
dc.SetBackground(wxBrush(wxColour("#ffffff"), wxSOLID));
dc.Clear();
m_dt->DrawBody(dc);
}
void coMyTableBody::OnMouseEvent(wxMouseEvent &event){
/*wxString sCursor = "default";
m_mgdData->OnMouseEventTable(event, sCursor);
if(sCursor == "default"){
wxScrolledWindow::SetCursor(*wxSTANDARD_CURSOR);
}else if(sCursor == "sizewe"){
wxScrolledWindow::SetCursor(wxCursor(wxCURSOR_SIZEWE));
}
Refresh();*/
}
Please help me.
Greetings kea_