Tweak width of the date editor
Don't make it larger than 150% than its normal width and also don't make it larger than its normal width at all if it's not going to be large enough to cover the entire cell anyhow -- this just looks strange, as the editor is both too wide and not wide enough.
This commit is contained in:
@@ -1793,11 +1793,12 @@ void wxGridCellDateEditor::SetSize(const wxRect& r)
|
|||||||
|
|
||||||
wxRect rect(r.GetPosition(), bestSize);
|
wxRect rect(r.GetPosition(), bestSize);
|
||||||
|
|
||||||
// Allow edit picker to become a bit wider, if necessary, but no more than
|
// Allow date picker to become a bit wider, if necessary, but not too wide,
|
||||||
// twice as wide as the best width, otherwise they just look ugly.
|
// otherwise it just looks ugly.
|
||||||
if ( r.GetWidth() > bestSize.GetWidth() )
|
if ( r.GetWidth() > bestSize.GetWidth()
|
||||||
|
&& r.GetWidth() < 3*bestSize.GetWidth()/2 )
|
||||||
{
|
{
|
||||||
rect.SetWidth(wxMin(r.GetWidth(), 2*bestSize.GetWidth()));
|
rect.SetWidth(r.GetWidth());
|
||||||
}
|
}
|
||||||
|
|
||||||
wxGridCellEditor::SetSize(rect.CenterIn(r, wxVERTICAL));
|
wxGridCellEditor::SetSize(rect.CenterIn(r, wxVERTICAL));
|
||||||
|
Reference in New Issue
Block a user