Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    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

    #2
    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).

    Comment


      #3
      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

      Comment


        #4
        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.

        Comment


          #5
          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

          Comment

          Working...
          X