in GUI Development by


when calling GetContentArea() the area without Formation info is returned. Is there a way to get the content area with the formation info?

Calling AdjustContent() does not effect the content area. 

Kind regards 


1 Answer

0 votes

Hello Jonas,

from technical point of view, when the value of the property Formation is changed or one of the embedded views has changed its size, the Outline Box requests the superior component to update its layout. The layout of the embedded views is thus not managed directly by the Outline Box but by the superior component. This update is performed with a short delay in order to accumulate multiple alternations and so optimize the entire layout update calculation. The superior component uses a postsignal to defer the execution. The delay is thus very short.

Nevertheless, if you invoke GetContentArea() too early, even before the superior component was able to perform the postsignal and update the layout, GetContentArea() returns the value corresponding to the actual layout. To avoid this problem you need to delay the invocation of GetContentArea(). Try to use a postsignal for this purpose. For example:

// Change the formation
Outline.Formation = Core::Formation.TopToBottom;

// Delay the following execution in order to see the changes caused
// by the above alternation of the property 'Formation':
postsignal Slot;

With this approach, the execution of Slot is slightly delayed. The invocation of the method GetContentArea() in context of Slot should then return the correct size.

Better and recommended approach is to associate a slot method to Outline's OnUpdate property. Then the Outline Box will signal this method automatically when something has changed in its layout. Using GetContentArea() in context of this method is safe and recommended. See also Enumerate and search views controlled by the Outline Box,

Does it help you further?

Best regards

Paul Banach

Hello Paul,

in my project the Outline property formation is set via inspector. In the Init of the Owner class of the Outline a signal is emitted. The corresponging slot calls GetContentArea.

Does that mean, that the Init of the Owner is executed before the Properties of the Outline are set?

It is also not possible to set the Formation in the Owners init. Can you explain that?

With connection of Outline's OnUpdate and the slot calling GetContentArea it works.

Hello Jonas,

properties are always set before Init() is invoked. Therefore when the Init() method postsignal to a slot method, the slot method should be able to get the correct area from Outline Box. Note following limitations:

1. In the Composer the automatic layout for the actually edited component is explicitly disabled to avoid interferences between user edit operations and the automatic layout. When you start the Prototyper, the functionality should work.

2. If just after the postsignal has been sent in Init() your implementation does perform some further operation affecting the layout, the pending layout update is delayed again. Such operation can be e,g. when you move or resize the views embedded within the Outline Box, you move/resize the Outline Box or you resize the superior component. Thus, the best and safest would be to perform the GetContentArea() invocation in context of OnUpdate.

Best regards

Paul Banach

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint