Regarding my previous post, in which I mentioned a problem with adding a control to a toolbar and not getting the right size (e.g. the toolbar was smaller in width than it should), I managed to do it by manually specifying the toolbar's best size, something like
- Code: Select all
wxToolBar* tbStandard = new wxToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTB_FLAT | wxTB_NODIVIDER);
// wxZoomCombo is a combo derived from wxOwnerDrawnComboBox
wxZoomCombo* pCmbZoom = new wxZoomCombo(tbStandard, wxID_CMB_ZOOM, wxSize(this->GetCharWidth()*10,wxDefaultCoord), this);
tbStandard->AddControl(pCmbZoom);
tbStandard->Realize();
tbStandard->CacheBestSize(wxSize( tbStandard->GetBestSize().x + pCmbZoom->GetSize().GetWidth(), tbStandard->GetBestSize().y - 1 ));
That did the trick, but I'm now experiencing something which looks like a drawing bug:
I'm using latest wxWidgets (e.g. 2.8.0) but I've also checked CVS and I couldn't find any significant code changes which address this issue.
Any ideas?
Thanks.
Editing this message later...
I don't know whether this was my mistake or not (I guess it was). Calling
- Code: Select all
tbStandard->SetToolBitmapSize(wxSize(16,16));
did the trick and the bug disappeared.
I shouldn't have posted the original message, but I struggled with this for almost an hour.
Thanks again.