- int y;
- GetTextExtent(_T("H"), (int*)NULL, &y, (int*)NULL, (int*)NULL, &font);
- int height = wxMax(y*(count + 3), 100);
- m_listctrl->SetSize(-1, height);
+ // but check that the dialog won't fall fown from the screen
+ //
+ // we use GetMinHeight() to get the height of the dialog part without the
+ // details and we consider that the "Save" button below and the separator
+ // line (and the margins around it) take about as much, hence double it
+ int heightMax = wxGetDisplaySize().y - GetPosition().y - 2*GetMinHeight();
+
+ // we should leave a margin
+ heightMax *= 9;
+ heightMax /= 10;
+
+ m_listctrl->SetSize(-1, wxMin(height, heightMax));