Thanks, Jesse, Coenraet's article was exactly what I needed.

Okay, two more questions now that I have a couple buttons in the panel:

1) One of the buttons spawns a menu like so:

function handleMenuButton ( event ) {
if ( _menuData ) {
winMenu = Menu.createMenu ( event.target, menuData );
winMenu.addEventListener ( "change", Delegate.create ( this, menuHandler ));
var pos = getGlobalPosition ( event.target );
winMenu.show ( pos.x + event.target.width, pos.y );
}
}

and debug code tells me it's executing addEventListener() without warnings, however menuHandler() is never getting called. Any ideas?

2) I just found the status text feature in the panel and have a bunch of uses flowing through my mind for it... the problem is the buttons sit right on top of it. I'd like to be able to have my new panel extending class to intercept whatever creates that text object and move it to the left out of the way of each button. I tried using the Coenraet's object inspecting class to view everything attached to the panel hoping to find it and only came across the variables themselves ( _status : String and _statusChanged : Boolean ). No movieclips. Again, I'm lost here. Any ideas?

Thanks a bunch :)
Seth


On Feb 03, 2005, at 10:52, JesterXL wrote:

If you don't want to use a mix-in, a class that basically adds stuff at runtime to an existing class (which from an OOP standpoint & Flex' future career, you shouldn't do, but from a Functional standpoint + Decorator is perfectly legal), then use Manish's example; he uses inheritance, much like the TitleWindow extends Panel and has a close button;

http://manish.revise.org/archives/2005/01/09/resizable-titlewindow-in-flex/

Also, Christophe Coenraets also has a great example of extending Panel:

http://coenraets.com/viewarticle.jsp?articleId=89

(if his site fails, hit refresh)

<x-tad-bigger>----- Original Message -----</x-tad-bigger>
<x-tad-bigger> </x-tad-bigger><x-tad-bigger>From:</x-tad-bigger><x-tad-bigger> </x-tad-bigger><x-tad-bigger>Seth Voltz</x-tad-bigger><x-tad-bigger> </x-tad-bigger>
<x-tad-bigger>To:</x-tad-bigger><x-tad-bigger> </x-tad-bigger><x-tad-bigger>Flex Coders</x-tad-bigger>
<x-tad-bigger>Sent:</x-tad-bigger><x-tad-bigger> Thursday, February 03, 2005 5:46 AM</x-tad-bigger>
<x-tad-bigger>Subject:</x-tad-bigger><x-tad-bigger> [flexcoders] Attempting to add a button to Panel titlebar</x-tad-bigger>

Fellow Flexcoders,

So I have been trying to place a button in the titlebar of one of my panels and started digging around. I remembered Jesse had put up an example of a mix-in class ( http://www.jessewarden.com/archives/2005/01/collapseable_pa.html ) for doing just that. I dug through the code and have had no luck. I have included the actionscript from my test file at the end of this message.

so my questions are:

1) Jesse, what voodoo do you do to get that to work? ;)
2) Everyone, is there a different way I can do this? Is Jesse's way the most efficient / elegant?

Thanks,
Seth

Code:

myPanel.mxml (root element is <mx:Panel /> with the following in a script tag, not including includes)

import mx.utils.*;
import de.richinternet.utils.Dumper;

private var menu_pb : Button;

public function initFunk ( ) {
Dumper.dump ( "Init..." );
_initMenuButton ( this ); // Not sure why I have to do this, but I don't got compile errors on menu_pb with this.
}

static private function _initMenuButton ( obj ) {
Dumper.dump ( "Init 2..." );

obj.onMenuButton = obj.onMenuButton;

obj.createClassObject ( Button, "menu_pb", obj.getNextHighestDepth ( ));
obj.menu_pb.label = ">";
obj.menu_pb.setSize ( 22, 22 );
obj.menu_pb.addEventListener ( "click", Delegate.create ( obj, obj.onMenuButton ));
}

private function onMenuButton ( ) {
Dumper.dump ( "Trace: fileShare.onMenuButton()" );
}

static private function _sizeOverload ( obj ) {
Dumper.dump ( "Size 2..." );
obj.super.size ( );
obj.menu_pb.move ( obj.width - obj.menu_pb.width - 8, 4 );
}

function size ( ) : Void {
Dumper.dump ( "Size..." );
super.size ( );
_sizeOverload ( this );
}

/* All dumps to the tracer are accounted for and in the expected order... */


Yahoo! Groups Links

� To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

� To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

� Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

Attachment: PGP.sig
Description: This is a digitally signed message part

Reply via email to