_*Problem description:*_ The code below below shows a window as in the
picture, when compiled with visual studio 2012 under windows 8.
void main() {
IupOpen(0,0);
Ihandle* dlg=IupDialog(
IupVbox(
IupHbox(
IupButton("TESTBUTTON 1",0),
IupButton("TESTBUTTON 2",0),
IupButton("TESTBUTTON 3",0),
IupButton("TESTBUTTON 4",0),
0),
IupButton("TESTBUTTON 5",0),
IupButton("TESTBUTTON 6",0),
IupButton("TESTBUTTON 7",0),
IupButton("TESTBUTTON 8",0),
0
)
);
IupShow(dlg);
IupMainLoop();
IupClose();
}
_
__*Suspected bug reason:*_ This was a hard nut to crack, but I think I
found the problem. GetSystemMetrics(SM_CXFRAME) behaves diffrently IF
THE SUBSYSTEM VERSION written into the .exe file header is 6.0 or more.
This can happen when compiling with visual studo 2012. The reason for
this is that microsoft needed to keep backward compabillity for
GetSystemMetrics for old programs. The reason for changes in
GetSystemMetrics has something to to with the new visual styles and WPF,
i dont really know and it does not matter.
*
_The solution_:* in file iupwin_dialog.c, around line 113, there is a
function *iupdrvDialogGetDecoration*, which calls
GetSystemMetrics(SM_...) as few times. I belive thoose calls should more
correctly add a border padding, for example, line 144 is currently:
*border = GetSystemMetrics(SM_CXFRAME); /* Thickness of the sizing
border around the perimeter of a window */*
*
but should be:
*border =
GetSystemMetrics(SM_CXFRAME)+GetSystemMetrics(SM_CXPADDEDBORDER); /*
Thickness of the sizing border around the perimeter of a window */*
*
SM_CXPADDEDBORDER, is only supported since windows vista, but
GetSystemMetrics should return 0 for invalid values, so this should work
on all systems.
Hope this helps
/Robert.P.
|