[flexcoders] Re: Shouldn't this VBox have a scrollbar?

2007-05-05 Thread scott_flex

You would think so... however, i have found that you have to set the 
height of a vBox to a pixel height, not percentage to get the 
scrollbars to act the way you want them to.

By default a vBox's height will autosize to the combined height, plus 
verticalGap... of all it's children, UNLESS you set it's pixel 
height, which then properly display's scrollbars.

In this case, I would bind the height of the vBox to it's parent 
canvas height, that should do it.

This is very weird to me as well, and if you contrain the layout of 
the vbox to be top=0 and bottom=0, as if you are wanting to anchor or 
dock it so it resizes when the parent resizes, it won't work either.

The height must be set to a pixel height.  To get around this i had 
to tie into the resize even of my parent container and convert the 
size of my vbox appropriately... annoying, not what i expected i 
would have to do.


hope that helps some

--Scott



--- In flexcoders@yahoogroups.com, Tom Bray [EMAIL PROTECTED] wrote:

 Shouldn't the height of the VBox below end up being 300?  
Shouldn't  
 height=100% make it fill up the area allotted to it by it's  
 parent?  Instead it ends up having a height of 612 and no scrollbar:
 
 ?xml version=1.0 encoding=utf-8?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;  
 layout=absolute horizontalScrollPolicy=off  
 verticalScrollPolicy=off
   mx:Canvas width=500 height=300 
horizontalScrollPolicy=off  
 verticalScrollPolicy=off
   mx:VBox id=badVBox width=100% height=100%
   mx:Canvas width=100% height=200 
backgroundColor=green/
   mx:Canvas width=100% height=200 
backgroundColor=green/
   mx:Canvas width=100% height=200 
backgroundColor=green/
   /mx:VBox
   /mx:Canvas
   
   mx:Button y=400 label=debug click=debug()/
   
   mx:Script
   ![CDATA[
   public function debug():void
   {
   var v:VBox = badVBox;
   }
   ]]
   /mx:Script
 
 /mx:Application





[flexcoders] Re: Shouldn't this VBox have a scrollbar?

2007-05-05 Thread scott_flex

Oh, and one more thing, hopefully i don't butcher this.

As explain to me before, using constrained layout on objects does not 
actually resize them, just anchors them based on teh top, bottom, 
left and right properties.  That's why you can't anchor a vBox on all 
sides and expect the scrollbars to appear correctly.

Constrained layout is NOT equal to Docking as some other editors, 
such as in Visual Studio refer to it.

This is wierd if you anchor on all 4 sides, put a border on your vbox 
and it does appear to grow with the parent display object it's anchor 
against, but again, the vbox size, at least for calculating 
scrollbars is NOT aware of this.  I assume this is very similar to 
using 100% values for width and height.

Weird and certain not what i would expect.

--Scott



--- In flexcoders@yahoogroups.com, Tom Bray [EMAIL PROTECTED] wrote:

 Shouldn't the height of the VBox below end up being 300?  
Shouldn't  
 height=100% make it fill up the area allotted to it by it's  
 parent?  Instead it ends up having a height of 612 and no scrollbar:
 
 ?xml version=1.0 encoding=utf-8?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;  
 layout=absolute horizontalScrollPolicy=off  
 verticalScrollPolicy=off
   mx:Canvas width=500 height=300 
horizontalScrollPolicy=off  
 verticalScrollPolicy=off
   mx:VBox id=badVBox width=100% height=100%
   mx:Canvas width=100% height=200 
backgroundColor=green/
   mx:Canvas width=100% height=200 
backgroundColor=green/
   mx:Canvas width=100% height=200 
backgroundColor=green/
   /mx:VBox
   /mx:Canvas
   
   mx:Button y=400 label=debug click=debug()/
   
   mx:Script
   ![CDATA[
   public function debug():void
   {
   var v:VBox = badVBox;
   }
   ]]
   /mx:Script
 
 /mx:Application





Re: [flexcoders] Re: Shouldn't this VBox have a scrollbar?

2007-05-05 Thread Tom Bray
Thanks, Scott.  It's nice to know I'm not crazy in thinking that this  
is unexpected behavior.  Hopefully the Adobe guys will weigh in on this.


I'll bind the height of the vbox to it's parent's height, but I'll do  
so with a heavy heart.


Thanks,

Tom


On May 5, 2007, at 3:09 PM, scott_flex wrote:



Oh, and one more thing, hopefully i don't butcher this.

As explain to me before, using constrained layout on objects does not
actually resize them, just anchors them based on teh top, bottom,
left and right properties. That's why you can't anchor a vBox on all
sides and expect the scrollbars to appear correctly.

Constrained layout is NOT equal to Docking as some other editors,
such as in Visual Studio refer to it.

This is wierd if you anchor on all 4 sides, put a border on your vbox
and it does appear to grow with the parent display object it's anchor
against, but again, the vbox size, at least for calculating
scrollbars is NOT aware of this. I assume this is very similar to
using 100% values for width and height.

Weird and certain not what i would expect.

--Scott

--- In flexcoders@yahoogroups.com, Tom Bray [EMAIL PROTECTED] wrote:

 Shouldn't the height of the VBox below end up being 300?
Shouldn't
 height=100% make it fill up the area allotted to it by it's
 parent? Instead it ends up having a height of 612 and no scrollbar:

 ?xml version=1.0 encoding=utf-8?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
 layout=absolute horizontalScrollPolicy=off
 verticalScrollPolicy=off
 mx:Canvas width=500 height=300
horizontalScrollPolicy=off
 verticalScrollPolicy=off
 mx:VBox id=badVBox width=100% height=100%
 mx:Canvas width=100% height=200
backgroundColor=green/
 mx:Canvas width=100% height=200
backgroundColor=green/
 mx:Canvas width=100% height=200
backgroundColor=green/
 /mx:VBox
 /mx:Canvas

 mx:Button y=400 label=debug click=debug()/

 mx:Script
 ![CDATA[
 public function debug():void
 {
 var v:VBox = badVBox;
 }
 ]]
 /mx:Script

 /mx:Application








[flexcoders] Re: Shouldn't this VBox have a scrollbar?

2007-05-05 Thread simonjpalmer
I suspect you may get closer to what you are looking for if you make
the height of each of your canvases in your vbox 33%, e.g.

mx:Canvas width=100% height=33% backgroundColor= green/
mx:Canvas width=100% height=33% backgroundColor= green/
mx:Canvas width=100% height=34% backgroundColor= green/

I presume you are deliberately switching the scrollbar off with
verticalScrollPolicy=off on the parent canvas.

The vbox is being told to occupy all of the available parent real
estate, but then being told to be 3 x 200 tall because of its
contents, and then not the scroll bar is disallowed.

Why not make your top level canvas the right size for your control?

--- In flexcoders@yahoogroups.com, Jas Kaur [EMAIL PROTECTED] wrote:

 The value of height=200 is making this happen
 
 mx:Canvas width=100% height=200 backgroundColor= green/
 mx:Canvas width=100% height=200 backgroundColor= green/
 
 
 - Original Message 
 From: Tom Bray [EMAIL PROTECTED]
 To: flexcoders@yahoogroups.com
 Sent: Saturday, May 5, 2007 5:36:08 PM
 Subject: [flexcoders] Shouldn't this VBox have a scrollbar?
 
 Shouldn't the height of the VBox below end up being 300?  Shouldn't
height=100%  make it fill up the area allotted to it by it's parent?
 Instead it ends up having a height of 612 and no scrollbar:
 
 
 ?xml version=1.0 encoding=utf- 8?
 mx:Application xmlns:mx=http://www.adobe. com/2006/ mxml
layout=absolute horizontalScrollPol icy=off verticalScrollPolic
y=off
 mx:Canvas width=500 height=300 horizontalScrollPol icy=off
verticalScrollPolic y=off
 mx:VBox id=badVBox width=100% height=100%
 mx:Canvas width=100% height=200 backgroundColor= green/
 mx:Canvas width=100% height=200 backgroundColor= green/
 mx:Canvas width=100% height=200 backgroundColor= green/
 /mx:VBox
 /mx:Canvas
 
 
 mx:Button y=400 label=debug click=debug( )/
 
 
 mx:Script
 ![CDATA[
 public function debug():void
 {
 var v:VBox = badVBox;
 }
 ]]
 /mx:Script
 
 
 /mx:Application
 
 
 __
 Do You Yahoo!?
 Tired of spam?  Yahoo! Mail has the best spam protection around 
 http://mail.yahoo.com





[flexcoders] Re: Shouldn't this VBox have a scrollbar?

2007-05-05 Thread simonjpalmer
It will never show a scroll bar while you have
verticalScrollPolicy=off in the parent canvas...

--- In flexcoders@yahoogroups.com, Tom Bray [EMAIL PROTECTED] wrote:

 Hi Jas,
 
 I expect the measuredHeight to be 612, which it is.  The problem is  
 that I also expect the VBox to respect the height of its parent  
 canvas (300) and thus display a vertical scrollbar.
 
 Thanks,
 
 Tom
 
 On May 5, 2007, at 3:17 PM, Jas Kaur wrote:
 
 
  The value of height=200 is making this happen
 
  mx:Canvas width=100% height=200 backgroundColor= green/
  mx:Canvas width=100% height=200 backgroundColor= green/
 
  - Original Message 
  From: Tom Bray [EMAIL PROTECTED]
  To: flexcoders@yahoogroups.com
  Sent: Saturday, May 5, 2007 5:36:08 PM
  Subject: [flexcoders] Shouldn't this VBox have a scrollbar?
 
 
  Shouldn't the height of the VBox below end up being 300?  Shouldn't  
  height=100%  make it fill up the area allotted to it by it's  
  parent?  Instead it ends up having a height of 612 and no scrollbar:
 
  ?xml version=1.0 encoding=utf- 8?
  mx:Application xmlns:mx=http://www.adobe. com/2006/ mxml  
  layout=absolute horizontalScrollPol icy=off verticalScrollPolic  
  y=off
  mx:Canvas width=500 height=300 horizontalScrollPol icy=off  
  verticalScrollPolic y=off
  mx:VBox id=badVBox width=100% height=100%
  mx:Canvas width=100% height=200 backgroundColor= green/
  mx:Canvas width=100% height=200 backgroundColor= green/
  mx:Canvas width=100% height=200 backgroundColor= green/
  /mx:VBox
  /mx:Canvas
 
 
  mx:Button y=400 label=debug click=debug( )/
 
 
  mx:Script
  ![CDATA[
  public function debug():void
  {
  var v:VBox = badVBox;
  }
  ]]
  /mx:Script
 
  /mx:Application
 
 
  The best gets better. See why everyone is raving about the All-new  
  Yahoo! Mail.
 
 





Re: [flexcoders] Re: Shouldn't this VBox have a scrollbar?

2007-05-05 Thread Tom Bray

Simon,

I don't want the parent canvas to own the scrollbar.  If I let the  
parent own the scrollbar, it obscures the right-most content of the  
VBox (or displays a horizontal scrollbar if I let it).  I want the  
vbox to respect the height=100% and thus have a height of 300 (in  
this example) and display a vertical scrollbar.


As Scott pointed out, binding the height of the VBox to the height of  
the parent achieves the result I'm looking for.  I just expected the  
VBox to behave this way already.


The code I sent is a test case to illustrate the problem I've run  
into in my app.  My app has a bunch of tabs and this particular tab  
contains a VBox that I'm using to display an arbitrary number of  
items that have varying heights.  (Let's say it's a list of 20 blog  
entries).  I'm using a VBox instead of a List control for several  
reasons, the two big ones being that I need smooth scrolling  
(itemRenderers in a List don't move as you scroll). and variable- 
height items.  I started out using a List with variableRowHeight, but  
it was a pain.  Since I didn't need any of the other List  
functionality and VBox provided everything I needed plus the smooth  
scrolling, here I am.


Thanks,

Tom


On May 5, 2007, at 3:35 PM, simonjpalmer wrote:


It will never show a scroll bar while you have
verticalScrollPolicy=off in the parent canvas...

--- In flexcoders@yahoogroups.com, Tom Bray [EMAIL PROTECTED] wrote:

 Hi Jas,

 I expect the measuredHeight to be 612, which it is. The problem is
 that I also expect the VBox to respect the height of its parent
 canvas (300) and thus display a vertical scrollbar.

 Thanks,

 Tom

 On May 5, 2007, at 3:17 PM, Jas Kaur wrote:

 
  The value of height=200 is making this happen
 
  mx:Canvas width=100% height=200 backgroundColor= green/
  mx:Canvas width=100% height=200 backgroundColor= green/
 
  - Original Message 
  From: Tom Bray [EMAIL PROTECTED]
  To: flexcoders@yahoogroups.com
  Sent: Saturday, May 5, 2007 5:36:08 PM
  Subject: [flexcoders] Shouldn't this VBox have a scrollbar?
 
 
  Shouldn't the height of the VBox below end up being 300? Shouldn't
  height=100%  make it fill up the area allotted to it by it's
  parent? Instead it ends up having a height of 612 and no  
scrollbar:

 
  ?xml version=1.0 encoding=utf- 8?
  mx:Application xmlns:mx=http://www.adobe. com/2006/ mxml
  layout=absolute horizontalScrollPol icy=off  
verticalScrollPolic

  y=off
  mx:Canvas width=500 height=300 horizontalScrollPol icy=off
  verticalScrollPolic y=off
  mx:VBox id=badVBox width=100% height=100%
  mx:Canvas width=100% height=200 backgroundColor= green/
  mx:Canvas width=100% height=200 backgroundColor= green/
  mx:Canvas width=100% height=200 backgroundColor= green/
  /mx:VBox
  /mx:Canvas
 
 
  mx:Button y=400 label=debug click=debug( )/
 
 
  mx:Script
  ![CDATA[
  public function debug():void
  {
  var v:VBox = badVBox;
  }
  ]]
  /mx:Script
 
  /mx:Application
 
 
  The best gets better. See why everyone is raving about the All-new
  Yahoo! Mail.