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.
I don't know if there is a more elegant way to know this; you could just use the GetTextExtents method with the longest text you want the control to be able to display, and then add some space for the arrows - that's the best i can think for
"Keyboard not detected. Press F1 to continue"
-- Windows
BFTimeCtrl::BFTimeCtrl (wxWindow* pParent,
int iHour /*= 0*/,
int iMinute /*= 0*/)
: wxBoxSizer(wxHORIZONTAL)
{
// hour
// try this:
wxString testStr( "99" ); // "largest" 2 digits..?
int w, h, someExtraSpace=10;
pHour_ = new wxSpinCtrl(pParent);
pHour_->GetTextExtent( testStr, &w, &h );
wxSize newSize( w + someExtraSpace, -1 ); // -1 for the height; height should already be according to the font used by the window
pHour_->SetSize( newSize );
//___
pHour_->SetRange(0, 23);
pHour_->SetValue(iHour);
//pHour_->Fit(); // is this needed?
// minute
// ...
// sizer
this->Add(pHour_, wxSizerFlags(0).FixedMinSize());
// just calling this->Add(pHour_); here should be enough also
Fit(pParent);
}
catalin wrote:I don't understand why but I suppose that didn't work, did it? :)
It did. Only the combination of SetSize() and wxSizerFlags(0).FixedMinSize() is successfull. I don't need to understand why SetMaxSize() has no effect. ;)