Skip to content


Flex Component : ButtonPanel puts a button in your panel header

It’s always a joy when you need something and after writing a few lines of code, you have it. Such is the beauty of nice extendable components and the Flex architecture.

Today I needed a panel which had a button in the top right corner of the header. Where the ’status’ text is normally is. I wanted to put a ’save’ button there. One problem, the mx.containers.Panel component does not have a button in the header.

Solution. Make a new component which extends all the functions of the Panel and stick a button in the top corner where I want.

Click here to see a demo

Click here to view the source

My new ButtonPanel component extends Panel and adds 2 new properties and 1 event.

Properties

buttonLabel : String – Defines the label for the button in the top corner
buttonPadding : Number – Defines how much padding to provide in the header

Event

buttonClick : Event – Dispatched when the button is clicked

Posted in Code, Components.

Tagged with , .


4 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. Marius says

    Cool, just what I needed.

  2. Trevor says

    This is excellent I have been looking for this capability

  3. Paul says

    Nice, but focus rect is off.
    Hit tab and see what happens…

  4. Tech Per says

    Cool stuff. Nice and simple. Just what I needed. Thanx!



Some HTML is OK

or, reply to this post via trackback.



close