469 views
in GUI Development by
How can create a variable to a view at a particular index into an Outline? Be it pixels or items in.

1 Answer

0 votes
by

Hi Mike,

I assume you want to move the content within an Outline Box - let me refer to the chapter Adjust the scroll position of an Outline Box.

Hope this helps...

Best regards,

Manfred.

by
I'll take a look. I'm looking to enable a SimpleTouchHandler at a known Offset or index in. And disable all others.

 

[EDIT: Ok I got this figured out...]

var Core::View view = null;

// disable SimpleTouchHandler for all views
var Application::ActiveModeBlock block;
var int32 viewcount = Outline.CountViews();
var int32 i;

for(i = 1; i < viewcount-1; i = i+1) // skip Left and RightSpacer!
{
   view = Outline.GetViewAtIndex(i);
   block = (Application::ActiveModeBlock)view;
   block.SimpleTouchHandler.Enabled = false;
}

// Enable SimpleTouchHandler for current view   
var int32 idx = ((SlideTouchHandler.Offset.x * -1) / block.Bounds.w)+1;
view = Outline.GetViewAtIndex(idx);       
block = (Application::ActiveModeBlock)view;                             
block.SimpleTouchHandler.Enabled = true;
by
Also, I do need to scroll the position as you mentioned as well. So I tried the following in Init{} but its not working.. what am I not understanding?

 

// Create a new animation effect instance.
var Effects::PointEffect effect = new Effects::PointEffect;

// Configure the animation duration and the timing (easing)
effect.Value2 = <-1000,0>;
effect.Value1 = <0,0>;

effect.CycleDuration = 250;  // milliseconds
effect.NoOfCycles    = 1;
effect.Timing        = Effects::Timing.Exp_InOut;
effect.Enabled = true;

// Finally instruct the Outline Box to adjust the scrolling offset
// with the prepared animation.
Outline.AdjustContent( effect, null );
by
Ah,
 Outline.EnsureVisible( view, true, effect, null );

did the trick.  However, it's right justified. As I fit 3 Views on the screen at a time. And it scrolls the view till it is the right most one. And not the center. Whats the best way to address that? FindNextView() ?

[EDIT: Got it.. view = Outline.FindNextView( view, Core::ViewState[]); ]
by
Trying to figure out how to have a Button slot method scroll the Outline to the right one view. This doesn't seem to be working:

var Core::View view = null;

view = FindViewInDirection( null, Core::Direction.Right, Core::ViewState[]);

// Create a new animation effect instance.
var Effects::PointEffect effect = new Effects::PointEffect;

// Configure the animation duration and the timing (easing)
effect.CycleDuration = 250;  // milliseconds
effect.NoOfCycles    = 1;
effect.Timing        = Effects::Timing.Exp_InOut;
effect.Enabled = true;
          
Outline.EnsureVisible( view, true, effect, null );

..or am I suppose to use AdjustContent() ?
by

According to the comments above, I assume that you have a number of items placed within an Outline Box and the Outline Box is larger than a single item so that more than one items are visible on the screen. And: Only the centered item should be enabled to react on touch events.

As long as the size of a single item is identical to the size of the Outline Box, it is easy and convenient to work with EnsureVisible(). However, the method EnsureVisible() does not center a certain item - it ensures that the item is visible.

In your case, let me recommend to calculate the necessary scroll offset and set or animate the property ScrollOffset of the Outline Box. Then you can compare the ScrollOffset with the Bounds of the items in order to find the centered item.

Of course, a few lines of code are necessary to calculate and compare the positions - but at the end you get exactly the desired behavior.

What do you think about that approach?

Best regards,

Manfred.

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

...