← Back to team overview

ubuntu-phone team mailing list archive

Re: Positioning the screen to an element in Expandable

 

On Wednesday 23 July 2014 17:57:13 Sam Bull wrote:
> I would like to position the screen so that it scrolls to a specific
> element after opening a page.
> 
> First, I'd like to be able to make sure an Expandable is in view upon
> expanding it (though this could be considered a bug of ExpandablesColumn
> that it doesn't do this automatically).

Hmm, that should work. I just tried the example from the doc and it expands 
fine.

> 
> But, then I'd also like to be able to bring certain sub-items to the top
> of the display.
> 
> Unfortunately, reading the .y attribute always gives 0 for all these
> elements. Likewise, trying to get the global position with something
> like:
>         root.mapFromItem(elem.parent, elem.x, elem.y).y
> always returns 76.

delegate.mapToItem(ListView.view)

> 
> I don't know if maybe the elements haven't finished loading or
> something. If that is the case, is there any way to connect to the
> elements positions when they are changed? I've tried things like
> elem.onYChanged = function() ... but it's not working.

I think the item's y should also work. Maybe its a problem with your delegate 
items?

Br,
Michael


Follow ups

References