Jump to content

The coordinates objects are given and real.


AlexK17
 Share

Recommended Posts

Hi

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.

1.PNG

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

Hi.

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

Hi.

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...