Jump to content

The coordinates objects are given and real.


Recommended Posts


I have the following problem. After creating an object, its coordinates and size can be changed by 1 or 2 points. Why?

Part program from gui.c

    // ghPBChangeSpeed
    wi.g.show = TRUE;
    wi.g.x = 32;
    wi.g.y = 135;
    wi.g.width = 205;
    wi.g.height = 120;
    wi.g.parent = ghPageContainerTermTestPage;
    wi.text = "";
    wi.customDraw = FRNone;
    wi.customParam = 0;
    wi.customStyle = 0;
    ghPBChangeSpeed = gwinButtonCreate(0, &wi);

Data from debuger in attached file.

Almost all objects undergo coordinate changes.


Link to comment
Share on other sites

Yes, the window manager will resize a widget to fit into the parent. This is where the inner size (inner width & inner height) come into play. Check the return values of gwinGetInnerWidth() and gwinGetInnerHeight() of the parent container. This will most likely return the values you initially reported. The WM has no other option but to resize the widget to fit those dimensions.

If your child needs to have those exact dimensions, either make the parent container larger or implement a container which handles this the way you need it. I think the default built-in container has a border vs. no-border option (check the docs). I think if you disable the border the inner size will not be reduced by the border size.

Link to comment
Share on other sites


In file gwin_container.c i found this #define BORDER_WIDTH        2 and change his value to zero. Coordinate displacement and resizing is not happening, but I'm not sure if I won't have problems in the future. I got problems because I tried to combine the background image in the main container and the buttons to speed up the work.

Best regards.

Link to comment
Share on other sites


Code for all container generate by ugfx studio 0.24.1.

    // Page container
    wi.g.show = FALSE;
    wi.g.x = 0;
    wi.g.y = 0;
    wi.g.width = 240;
    wi.g.height = 320;
    wi.g.parent = 0;
    wi.text = "Container";
    wi.customDraw = background_OtherTestPageBg;
    wi.customParam = 0;
    wi.customStyle = &TextWhiteWS;
    ghPageContainerTermTestPage = gwinContainerCreate(0, &wi, GWIN_CONTAINER_BORDER);

and 5 more similar containers as project pages. 

If i redefine GWIN_CONTAINER_BORDER to zero in giu.c Coordinate and size still is good.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...