Skip to content
This repository was archived by the owner on Aug 6, 2025. It is now read-only.
This repository was archived by the owner on Aug 6, 2025. It is now read-only.

get_width/height/content_width.. returning 0 #4

@KimBP

Description

@KimBP

I make a class, say ContDer derived from Container supposed to contain some subobjects.

In my code I first create a 'screen' based on root which is my scr_act();

auto root = src_act();
screen = std::make_uniquelvgl::core::Container(root);
screen->set_size(root.get_width(), root.get_height());
I then set it up for grid layout
I can print out root dimensions which are correct.
but printing out screen dimension (screen->get_width() ) just returns 0

Inside screen I create an ContDer object which due to my column descriptor becomes half the size of screen (With borders enabled I can see it works correct)

contDer = std::make_unique(*screen);

In my constructor of condDer I want to add yet a container supposed to 'host' a label. I call it nameContainer

Container nameContainer(*this);
nameContainer.set_size(this->get_content_width(), someHeight);

By some reason get_content_width() as well as get_width() and corresponding height functions return 0.

Except from putting it into my class I don't find it different from what you show in the last example in the README.

Any suggestion on that problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions