From 7e9f0c4c5912f8d78345f4192165eed16a056342 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Fri, 5 Jun 2015 15:53:26 -0400 Subject: [PATCH] Settled date-time picker height issues. --- redo/windows/datetimepicker.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/redo/windows/datetimepicker.c b/redo/windows/datetimepicker.c index 7b8a7c3c..b4470478 100644 --- a/redo/windows/datetimepicker.c +++ b/redo/windows/datetimepicker.c @@ -119,15 +119,19 @@ static uintptr_t datetimepickerHandle(uiControl *c) return (uintptr_t) (d->hwnd); } -// TODO -// TODO DTM_GETIDEALSIZE results in something too big +// the height returned from DTM_GETIDEALSIZE is unreliable; see http://stackoverflow.com/questions/30626549/what-is-the-proper-use-of-dtm-getidealsize-treating-the-returned-size-as-pixels // from http://msdn.microsoft.com/en-us/library/windows/desktop/dn742486.aspx#sizingandspacing -#define entryWidth 107 /* this is actually the shorter progress bar width, but Microsoft only indicates as wide as necessary */ #define entryHeight 14 static void datetimepickerPreferredSize(uiControl *c, uiSizing *d, intmax_t *width, intmax_t *height) { - *width = uiWindowsDlgUnitsToX(entryWidth, d->Sys->BaseX); + struct datetimepicker *dd = (struct datetimepicker *) c; + SIZE s; + + s.cx = 0; + s.cy = 0; + SendMessageW(dd->hwnd, DTM_GETIDEALSIZE, 0, (LPARAM) (&s)); + *width = s.cx; *height = uiWindowsDlgUnitsToY(entryHeight, d->Sys->BaseY); }