Panel scrolling problem in Adobe Flex 3

Currently, I have an object that extends the Panel class in Flex.  In that object, I add a child that is an object that extends the Canvas class.

My problem is when the Canvas object is getting rendered, and it's larger than the parent Panel object, I get several different problems depending on if the Canvas object has children.

If the Canvas object does NOT have children and it's larger than the parent Panel object, it's drawn OVER the Panel object.  

If the Canvas object DOES have children and it's larger than the parent Panel object, the Canvas objects does NOT draw over Panel object. However, in both scenarios, the scroll bars on the parent Panel object do not take effect and display.

I have the set the "clipContent" property on the parent Panel object to true. I have turned OFF the horizontal and vertical scrolling properties on the child Canvas object, in order to keep the scroll bars from showing there.  The scroll bars on the Canvas object actually do work. However, that's not the intended result I want.

I need help getting the scroll bars to show and work on the parent Panel object.
ljthomas324Asked:
Who is Participating?
 
ljthomas324Author Commented:
I fixed my problem.  

What fixed it is overwriting the measure() method in my class that extends the Canvas class.

Check out the code snippet.  This caused the scroll bars to show up in my Panel sub-class.
override protected function measure():void 
{
    super.measure();
            
    measuredMinHeight = parent.height;
    measuredMinWidth = parent.width; 
}

Open in new window

0
 
Gary BenadeCommented:
If you haven't solved this yet please post the mxml you are testing with.
0
 
sinfreeCommented:
I'm seeing a very similar bizarre problem, so you aren't going crazy :).  I think it is probably a related (or the same) issue, maybe a flex bug.

I have a class that extends a panel, and it has a bunch of children who each extend canvas.  When I add them to the the canvas, the children start drawing beneath the panel header, and if there is a scroll bar, it overlaps the panel header (very ugly).  I tried adding a top padding, which got the children out from under the panel header, but the scroll bar is still all wacky.  My code is rather simple, and I don't see anything strange to cause this problem.  I'll let you know if I stumble across a solution to my issue.

 
public class MyClass extends Canvas
{
  ...
}
 
public class CustomPanel extends Panel
{
  ...
  var foobar:MyClass = new MyClass();
  addChild(fooBar)
  // add several more children of type MyClass
  ...
}

Open in new window

0
 
Gary BenadeCommented:
I can't replicate the problem in flex builder 3.0.1

Change the code below so that it breaks and post it back
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:local="*">
	<local:MyPacel width="364" height="366">
		<local:MyCanvas width="351" height="140" borderStyle="solid">
			<mx:DataGrid width="1000" height="100">
				
			</mx:DataGrid>
		</local:MyCanvas>
		<local:MyCanvas width="351" height="63" borderStyle="solid">
			
		</local:MyCanvas>
		<local:MyCanvas width="417" height="44" borderStyle="solid">
			
		</local:MyCanvas>
		<local:MyCanvas width="346" height="29" borderStyle="solid">
			
		</local:MyCanvas>
		<local:MyCanvas width="351" height="63" borderStyle="solid">
			
		</local:MyCanvas>
		<local:MyCanvas width="351" height="63" borderStyle="solid">
			
		</local:MyCanvas>
	</local:MyPacel>	
</mx:Application>
 
//MyCanvas.as
package
{
	import mx.containers.Canvas;
	
	public class MyCanvas extends Canvas 
	{
		public function MyCanvas()
		{
		}
 
	}
}
 
 
//MyPacel.as
package
{
	import mx.containers.Panel;
	
	public class MyPacel extends Panel
	{
		public function MyPacel()
		{
		}
 
	}
}

Open in new window

0
 
sinfreeCommented:
I found a solution to making the a child component of a panel to display it's scrollbar.  Simply set it's minHeight to 0.  So my problem is taken care of.  The issue is covered here:

http://bugs.adobe.com/jira/browse/SDK-13884

I'm not sure if this addresses the original problem in this thread or not, but hopefully it helps.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.