Select to view content in your preferred language

Disappearing scroll bars

859
4
07-08-2011 07:11 AM
DanJensen
Deactivated User
All,

I have developed a custom widget in which I dynamically add information to a vGroup from related records when the user clicks the map.  Sometimes the number of records are more than the widget can display, so I added scroll bars to the widget.  It struck me as odd that I had to add the scroll bars as I thought the widget would do this automatically.  However, adding scroll bars worked the first time the user opens the widget.  If the user closes the widget and then re-opens it again, the scroll bars do not appear.  Anyone have clue why they do not appear when the widget is re-opened?

Additional info: code
<viewer:WidgetTemplate id="RI" closed="RI_closed()" addedToStage="RI_addedToStage()">
 <s:Scroller id="resultsScoller" width="100%" height="100%">
  <s:VGroup id="resultsGroup">
   <s:Label text="Click a feature on the map to
     retrieve related information" fontSize="14" fontWeight="bold" 
                                                    fontStyle="italic"/>
  </s:VGroup>
 </s:Scroller>
</viewer:WidgetTemplate>


Thanks,
Dan
Tags (2)
0 Kudos
4 Replies
AlexJones
Emerging Contributor
By default the Scroller displays its scrollbars when they�??re needed�??when the viewport�??s content size is larger than its actual size. You can change this policy with the verticalScrollPolicy and horizontalScrollPolicy properties. The default value for these properties, auto, causes the scrollbars to display as needed. Set these properties to on to unconditionally display a scrollbar, and off to unconditionally hide a scrollbar.

http://www.adobe.com/devnet/flex/articles/flex4_viewport_scrolling.html

<s:Scroller horizontalScrollPolicy="on" verticalScrollPolicy="on"
0 Kudos
DanJensen
Deactivated User
Forum,

Additional detail.  While it remains true that the scroll bars are not visible, the scrolling functionallity works when I use the scroll wheel on the mouse.  It is as if the scrollbars themselves are outside the viewable area.  Any idea why this happens on the second instantiation of the widget, but not the first? 

When the widget closes I remove all the elements within the vGroup(resultsGroup).  Could this impact the scroller which is the parent of the vGroup in some way?

Thanks,
Dan
0 Kudos
DanJensen
Deactivated User
Turns out the problem is using the removeAllElements() function on the resultsGroup unfortunately removes the scroll bar as well.  Now I need to know how to remove spedific elements from the VGroup as I close the widget.  This will allow the widget to look reset when the user calls it again.

Thanks,
-Dan
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Dan,

  You should be just setting the ArrayCollection that is the datadprovider for your datagroup to null.
0 Kudos