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.

------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to