I'm debugging a problem where the standard buttons on a property sheet are misplaced. The application is Magna Cura. The screenshot http://www.cendio.com/~astrand/wine/62-tab-size/unpatched.png demonstrates the problem: The buttons are only partially visible. It turns out that the parent window for the Buttons changes size several times. The height is:
228 95 466 436 450
The PROPSHEET_AdjustButtons function, however, is only called in WM_INITDIALOG, so the buttons are positioned based on the height 466, and never repositioned. What's the proper fix for this? I've tried this patch:
--- propsheet.c (revision 13243) +++ propsheet.c (arbetskopia) @@ -3828,6 +3828,13 @@ return TRUE; }
+ case WM_WINDOWPOSCHANGED: + { + PropSheetInfo* psInfo = (PropSheetInfo*) lParam; + PROPSHEET_AdjustButtons(hwnd, psInfo); + return FALSE; + } + default: return FALSE; }
This solves the position problem, but instead the Help button disappears. See screenshot http://www.cendio.com/~astrand/wine/62-tab-size/patched.png. Any ideas?
Best regards, --- Peter Åstrand ThinLinc Chief Developer Cendio AB http://www.cendio.se Wallenbergs gata 4 583 30 Linköping Phone: +46-13-21 46 00
ThinLinc User Group 2007 Höstkonferens --- 15-16 november, Linköping. Program och anmälan: http://www.thinlincusergroup.se/aktiviteter
On 26.10.2007 16:52, Peter Åstrand wrote:
This solves the position problem, but instead the Help button disappears. See screenshot http://www.cendio.com/~astrand/wine/62-tab-size/patched.png. Any ideas?
Hint: check again what WM_WINDOWPOSCHANGED's 'lParam' contains ...
-f.r.
On Fri, 26 Oct 2007, Frank Richter wrote:
On 26.10.2007 16:52, Peter Åstrand wrote: This solves the position problem, but instead the Help button disappears. See screenshot http://www.cendio.com/~astrand/wine/62-tab-size/patched.png. Any ideas?
Hint: check again what WM_WINDOWPOSCHANGED's 'lParam' contains ...
Thanks. I've now fixed this problem. I discovered another bug, though: The implementation does not take into account that the caller might do ShowWindow(FALSE) on the help and apply buttons. The patch below fixes this problem as well. I will file a bug.
--- propsheet.c (revision 13243) +++ propsheet.c (arbetskopia) @@ -865,10 +865,12 @@ int buttonWidth, buttonHeight; PADDING_INFO padding = PROPSHEET_GetPaddingInfo(hwndParent);
- if (psInfo->hasApply) + hwndButton = GetDlgItem(hwndParent, IDC_APPLY_BUTTON); + if (psInfo->hasApply && GetWindowLongW(hwndButton, GWL_STYLE) & WS_VISIBLE) num_buttons++;
- if (psInfo->hasHelp) + hwndButton = GetDlgItem(hwndParent, IDHELP); + if (psInfo->hasHelp && GetWindowLongW(hwndButton, GWL_STYLE) & WS_VISIBLE) num_buttons++;
/* @@ -3828,6 +3830,17 @@ return TRUE; }
+ case WM_WINDOWPOSCHANGED: + { + PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwnd, PropSheetInfoStr); + + if (!psInfo) + return FALSE; + + PROPSHEET_AdjustButtons(hwnd, psInfo); + return FALSE; + } + default: return FALSE; }
Regards, --- Peter Åstrand ThinLinc Chief Developer Cendio AB http://www.cendio.se Wallenbergs gata 4 583 30 Linköping Phone: +46-13-21 46 00
ThinLinc User Group 2007 Höstkonferens --- 15-16 november, Linköping. Program och anmälan: http://www.thinlincusergroup.se/aktiviteter