811 views
in GUI Development by

Hi,

I have a screen, with a GUI component in it (my own widget). The GUI component (Widget) on the parent screen has bounds <0,280,800,480>, but the actual widget (internally) has bounds <0,0,800,300>

I would like to be able to resize the (internal) GUI components bounds <0,0,800,300> so that it would fit properly inside <0,280,800,480>, and have this done at runtime.

Trying to achive this brought me to my second question;

I am overriding the init functions for both the screen and the GUI component (Widget). I would like to have my screens init called before the GUI components (Widgets) init, as I would like to set up properties that are required by the (Widgets) init function. How can I change the order init functions are called in?

Thanks,

Oliver

1 Answer

0 votes
by

Hello Oliver,

do I assume correcly, that the Widget components are embedded inside the Screen components? If this is the case, the order in which the Init methods are invoked is pre-determined. Precisely: when an object is created, all other objects embedded inside it are initialized before. As soon as all embedded objects have finalized their initialization, the superior object can perform its own initialization.

This is essential, otherwise the superior object would be able to perform operations and access embedded objects, which are not yet initialized. 

Without knowing your exact application case I would suggest two ideas:

1. In the superior component (the Screen?) use the UpdateLayout() method to adjust/arrange the embedded Widget components.

2. Use within the Init method the postsignal statement to defer operations. See my answer in ReInit method called in different order in simulation and in target.

If the problem is releated to the initialization of sibling objects (e.g. components coexisting within the same owner component) , their initialization order does correspond to the order in which the objects are listed in Inspector. Please see: Members area and Reorder members.

Does it help you further?

Best regards

Paul Banach

Ask Embedded Wizard - Archive

Welcome to the Ask Embedded Wizard archive. This community forum served us well for many years, but we've evolved our support approach!

Your resources:

The Embedded Wizard Online Documentation provides comprehensive documentation, tutorials, examples and ready-to-use software packages.

For dedicated assistance, explore our Embedded Wizard Product Support.

You can still browse the valuable discussions from our community history here.

Embedded Wizard Website | Privacy Policy | Imprint

...