in Embedded Wizard Studio by
Hi need to synch the position of vertical scroll bar according to the position

change occurs when slides the outline using slide touch handler.

How can we achieve this

1 Answer

0 votes

Hello GML,

Once you have added a Horizontal Scrollbar or/and Vertical Scrollbar to your component and arrange it where you want it to appear you implement some glue code so the scrollbar is updated when the Outline Box is scrolled or its content changes. For this purpose you:

Step 1: add a new slot method and connect it to Outline Box property OnUpdate as described in the section Enumerate and search views controlled by the Outline Box.

Step 2: Within the slot method you implement the code to update the scrollbar according to the actual status of the Outline Box. For example in case of the Vertical Scrollbar:

// Get the area enclosing the views within the Outline Box as well as the
// visible area of the Outline Box itself.
var rect contentArea   = Outline.GetContentArea( Core::ViewState[ Visible ]);
var rect outlineBounds = Outline.Bounds;

// Update the status of the scrollbar
VerticalScrollbar.ContentArea = contentArea.h;
VerticalScrollbar.ViewArea    = outlineBounds.h;
VerticalScrollbar.Position    = outlineBounds.y1 - contentArea.y1;

See also the section: Determine the scrollbar's current scroll position and scroll range (for the Vertical scrollbar) or the same for the horizontal scrollbar.

I hope it helps you further.

Best regards

Paul Banach

Embedded Wizard Website | Privacy Policy | Imprint