Go Back   SmartClient Forums > Technical Q&A
Wiki Register Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 12th Jan 2011, 03:34
martintaal martintaal is offline
Registered Developer
 
Join Date: Oct 2010
Posts: 333
Default Expanding section item how to scroll contents into view?

Hi,
I have a SectionItem which is located in the bottom of the form. When I expand the SectionItem scrollbars are shown on the right (that's correct), but I would like to have the contents of the SectionItem to be scrolled into view.

Is there a way of accomplishing this?

gr. Martin
Reply With Quote
  #2  
Old 12th Jan 2011, 13:01
Isomorphic Isomorphic is offline
Administrator
 
Join Date: May 2006
Posts: 30,580
Default

Focusing in the first field in the section will automatically bring at least that field into view. To scroll further, use scrollTo() after determining the bottom coordinate of the item you want to scroll to (there are getPageLeft, getHeight() etc on FormItem).
Reply With Quote
  #3  
Old 12th Jan 2011, 20:35
martintaal martintaal is offline
Registered Developer
 
Join Date: Oct 2010
Posts: 333
Default

I tried scrollToBottom and although it works I get strange up and down jumping as the form first tries to focus in the top item, so jumps up after expanding and then down again.

Just imho, but I think it should be default behavior of Smartclient to scroll the section into view when it gets expanded.

What do you think? (or maybe a tip on how I can prevent this up and down jumping, I tried to clear the focus item in the form but it did not help...)

My 'problem' is that within the SectionItem I have a CanvasItem which does not necessarily has content which can be focused.

gr. Martin
Reply With Quote
  #4  
Old 13th Jan 2011, 18:25
Isomorphic Isomorphic is offline
Administrator
 
Join Date: May 2006
Posts: 30,580
Default

You should be able to get rid of the jumping by turning off autoFocus if it's set and calling redraw() explicitly on the form after opening the new section (redraw would normally occur after a delay, and in the meantime, sizes won't be final).

If that's not solving the problem, turn on the "nativeFocus" log category to get an idea of where focus is moving.
Reply With Quote
  #5  
Old 16th Jan 2011, 12:00
martintaal martintaal is offline
Registered Developer
 
Join Date: Oct 2010
Posts: 333
Default

Thanks, I solved this by explicitly setting the focus to the SectionItem or to a first focusable form item within the SectionItem when it expands.
Then I use scrollTo to scrollTo to the SectionItem.

This works fine, thanks!

gr. Martin
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search


© 2010,2011 Isomorphic Software. All Rights Reserved