Solved

Panel scrolling problem in Adobe Flex 3

Posted on 2008-10-01
5
1,826 Views
Last Modified: 2012-05-05
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.
0
Comment
Question by:ljthomas324
  • 2
  • 2
5 Comments
 
LVL 19

Expert Comment

by:Gary Benade
ID: 22718470
If you haven't solved this yet please post the mxml you are testing with.
0
 

Expert Comment

by:sinfree
ID: 22844305
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
 
LVL 19

Expert Comment

by:Gary Benade
ID: 22848001
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
 

Expert Comment

by:sinfree
ID: 22848023
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
 

Accepted Solution

by:
ljthomas324 earned 0 total points
ID: 22850746
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

Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
Starting your own business is always a daunting process, and for most people it is brand new experience. Avoid the common pitfalls by following these tips to start on the road to success.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question