Solved

Panel scrolling problem in Adobe Flex 3

Posted on 2008-10-01
5
1,829 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

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…
Facebook has became the #1 social media platform. People share many funny videos there, yet you don't know how to download them? Now you can download Videos from Facebook in just 3 simple steps.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

740 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