Duane Clark wrote:
This adds support for the updown control in the datetime picker (previously it existed but did nothing).
...
@@ -874,13 +1008,23 @@ DATETIME_Size (DATETIME_INFO *infoPtr, W TRACE("Height=%ld, Width=%ld\n", infoPtr->rcClient.bottom, infoPtr->rcClient.right);
infoPtr->rcDraw = infoPtr->rcClient;
- /* set the size of the button that drops the calendar down */
- /* FIXME: account for style that allows button on left side */
- infoPtr->calbutton.top = infoPtr->rcDraw.top;
- infoPtr->calbutton.bottom= infoPtr->rcDraw.bottom;
- infoPtr->calbutton.left = infoPtr->rcDraw.right-15;
- infoPtr->calbutton.right = infoPtr->rcDraw.right;
if (infoPtr->dwStyle & DTS_UPDOWN) {
/* the updown control seems to ignore SetWindowPos messages */
DestroyWindow(infoPtr->hUpdown);
/* hmmm... the updown control seems to ignore the width parameter */
infoPtr->hUpdown = CreateUpDownControl (WS_CHILD | WS_BORDER | WS_VISIBLE,
infoPtr->rcClient.right-14, 0, 20, infoPtr->rcClient.bottom,
infoPtr->hwndSelf, 1, 0, 0, UD_MAXVAL, UD_MINVAL, 0);
}
else {
/* set the size of the button that drops the calendar down */
/* FIXME: account for style that allows button on left side */
infoPtr->calbutton.top = infoPtr->rcDraw.top;
infoPtr->calbutton.bottom= infoPtr->rcDraw.bottom;
infoPtr->calbutton.left = infoPtr->rcDraw.right-15;
infoPtr->calbutton.right = infoPtr->rcDraw.right;
}
/* set enable/disable button size for show none style being enabled */ /* FIXME: these dimensions are completely incorrect */
This seems really wrong. You are destroying and creating the updown control on every size event?!?! That's really going to slow resizes down. Is there any evidence that the native version does it like this?
Rob
Rob Shearman wrote:
This seems really wrong. You are destroying and creating the updown control on every size event?!?! That's really going to slow resizes down. Is there any evidence that the native version does it like this?
No, I don't have evidence of that. On the other hand, it is unlikely the control will ever be resized, except once after creation. Looking through the messages that the updown control responds to, there are none that allow resizing that I can see. And while I have not verified this with Microsoft docs, it supposedly implements all documented functions (according to the header).
Duane Clark wrote:
Rob Shearman wrote:
This seems really wrong. You are destroying and creating the updown control on every size event?!?! That's really going to slow resizes down. Is there any evidence that the native version does it like this?
No, I don't have evidence of that. On the other hand, it is unlikely the control will ever be resized, except once after creation. Looking through the messages that the updown control responds to, there are none that allow resizing that I can see. And while I have not verified this with Microsoft docs, it supposedly implements all documented functions (according to the header).
I have tested using ControlSpy & Spy++ and indeed it isn't destroyed after each resize. Using SetWindowPos works for me. Can you make sure the app still works with the attached patch?
Rob
Robert Shearman wrote:
I have tested using ControlSpy & Spy++ and indeed it isn't destroyed after each resize. Using SetWindowPos works for me. Can you make sure the app still works with the attached patch?
Yep, that works fine.