20 views
in GUI Development by
Hello,

Currently I am using a scroll area, an outline and a scroll bar in multiple classes which have always the same functionality.

Scroll area and outline position and size are identical, the scroll bar is on the right. When moving the scroll bar or sliding the scroll area, the outline and the scroll bar position must be adapted.

I want to create a generic class which i can insert in other classes.

This problem is, that i can not use the "embedded" functionality, because an outline has to be in the same class as the embedded object.

Is it possible to assign an object to an outline of another class?

Is there any other way to create a generic class, maybe without an outline?

Best Regards Jonas

1 Answer

0 votes
by
 
Best answer

Hello Jonas,

I see following options how to implement your application case:

Option 1: Common "scroll component" base class

You implement a GUI component containing the outline box, the scrollbar and all the functionality to update the scrollbar/outline box in response to user interactions. This component serves thereupon as the base class for all other components where you expect the scroll behavior. The derived subclasses inherit the functionality implemented in the base class.

For more details see Subclassing components.

Option 2: Implement a dedicated "scroll area" component

This approach, probably, is what you try to do do actually. You implement a GUI component containing an outline box, scrollbar and all the functionality needed to update them. Then wherever you need the scroll area you embed an instance of your "scroll area" component. The problem here: the "scroll area" is an embedded object and you can't add other embedded object to an already embedded object visually via drag&drop in the Composer window. The solution: the views you want to scroll within the scroll area have to be created and added programatically. Assuming ScrollBox is the name of an instance of the "scroll area" component, you can add a component (or any other view) to it by using the method Add(). Please note that the Embedded property of the affected view is set true:

var Examples::SomeGUIComponent component = new Examples::SomeGUIComponent;

component.Embedded = true;

ScrollBox.Add( component, 0 );

For more details see Compose the component programmatically.

Option 3: Use a "scroll area" template

With this approach you store the implementation needed for the "scroll area" as template. For this purpose you create in the Gallery a new folder where you can store your own templates. Then you select in Composer the outline box, the scrollbar and all the variables, methods, etc. needed by your "scroll area" implementation and drag them together to your Gallery folder. This creates a template of the copied members. Once the template is available you can drag&drop it from the Gallery to all GUI components where the scroll functionality is needed. This results in copies of the "scroll area" functionality. 

For more details please see Managing templates.

Does it help you further?

Best regards

Paul Banach

by
Hallo Paul,

thanks for your reply. This helps a lot. I think the Template solution is what i was looking for. I have not thought about this method.

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

...