in GUI Development by
I am creating a interface where I would like one object to replace another within a given outline. However, I would like the new object to take on the index and the position of the old object. is there a method by which to rearrange the indices of an outline such that an object is embedded in a particular position/at a particular index?

1 Answer

+1 vote

Hello lopp2022,

if the new view object is not yet added to GUI component, use the method AddBehind( newView, oldView ). Then remove the old view from the component. If the view is already part of the GUI component, you can rearrange its position by using RestackBehind( theView, oldView ). Again, you do this before you remove the old view.

From your question I understood the views are managed by an Outline Box. Thus don't forget to set property Embedded of the new view before you add it to the component. Following could be a code sample:

// The old view you plan to replace
var Core::View oldView = ...

// Let's assume the new view should be a rectangle view
var Views::Rectangle newView = new Views::Rectangle;

// Ensure the new view will be managed by outline box.
newView.Embedded = true;

// Also configure other properties of the view (e.g. color, etc.)
newView.Bounds.size = <100,100>;
newView.Color       = #FF0000FF;

// Add the new view just behind the old view
AddBehind( newView, oldView );

// Remove the old view
Remove( oldView );

For more details concerning the both methods please see the chapter Compose the component programmatically. See also the section Enumerate and search views controlled by the Outline Box if you need to find the old view before you add a new view.

I hope it helps you further.

Best regards

Paul Banach

Exactly what I needed!!


Thank you

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