[EMAIL PROTECTED] Wed Apr 07 09:01:23 2004
Return-Path: <[EMAIL PROTECTED]>
X-Sender: [EMAIL PROTECTED]
X-Apparently-To: [email protected]
Received: (qmail 11527 invoked from network); 7 Apr 2004 15:28:20 -0000
Received: from unknown (66.218.66.218)
  by m12.grp.scd.yahoo.com with QMQP; 7 Apr 2004 15:28:20 -0000
Received: from unknown (HELO p15112434.pureserver.info) (217.160.168.91)
  by mta3.grp.scd.yahoo.com with SMTP; 7 Apr 2004 15:28:20 -0000
Received: from [10.44.4.2] ([213.128.227.106])
  (authenticated (0 bits))
  by p15112434.pureserver.info (8.11.6/8.11.6) with ESMTP id i37FRXf01896
  for <[email protected]>; Wed, 7 Apr 2004 16:27:33 +0100
To: [email protected]
In-Reply-To: <[EMAIL PROTECTED]>
References: <[EMAIL PROTECTED]>
  <[EMAIL PROTECTED]>
Content-Type: text/plain
Organization: iteration::two
Message-Id: <[EMAIL PROTECTED]>
Mime-Version: 1.0
X-Mailer: Ximian Evolution 1.4.6 
Date: Wed, 07 Apr 2004 16:27:26 +0100
Content-Transfer-Encoding: 7bit
X-eGroups-Remote-IP: 217.160.168.91
From: Alistair McLeod <[EMAIL PROTECTED]>
Subject: RE: [flexcoders] combobox with graphics and text
X-Yahoo-Group-Post: member; u=151017110
X-Yahoo-Profile: alimcleod

Hi,

I've thrown together a blog entry about creating a combo box with icons,
including a couple of screenshots. It can be found here:

http://www.richinternetapps.com/archives/000048.html

Cheers,

Ali


On Wed, 2004-04-07 at 11:08, Alistair McLeod wrote:
> Hi,
> 
> Yes, custom Cell Renderers can be a better solution if we want more
> control over what is being shown. Here is one i created to show a
> debit or credit icon in a control (based heavily on an example that
> ships with Flex). It could be extended to create both an image and a
> Label as the cells for a combo box.
> 
> import mx.core.UIComponent
> import mx.controls.Image
> 
> class com.iterationtwo.components.ImageCellRenderer extends
> UIComponent
> {
> [Embed(source="debit.png")]
> var debitSymbol:String;
> [Embed(source="credit.png")]
> var creditSymbol:String;
> 
> var image : MovieClip;
> var listOwner : MovieClip; // the reference we receive to the
> list
> var getCellIndex : Function; // the function we receive from
> the list
> var getDataLabel : Function; // the function we receive from
> the list
> 
> function ImageCellRenderer()
> {
> }
> 
> function createChildren(Void) : Void
> {
> image = createClassObject( Image, "image", 1,
> {styleName:this, owner:this});
> size();
> }
> 
> function size(Void) : Void
> {
> image._x = (layoutWidth-20)/2;
> image._y = (layoutHeight-16)/2;
> }
> 
> function setValue( str:String, item:Object, sel:Boolean ) :
> Void
> {
> var currentImage:String = image.source;
> var newImage:String = "";
> 
> if ( item.type == "CDT" )
> newImage = creditSymbol;
> else if ( item.type == "DBT" )
> newImage = debitSymbol;
> 
> if ( newImage != currentImage )
> image.source = newImage;
> }
> 
> function getPreferredHeight(Void) : Number
> {
> return 16;
> }
> 
> function getPreferredWidth(Void) : Number
> {
> return 20;
> }
> 
> }
> 
> 
> On Wed, 2004-04-07 at 10:58, Waldo Smeets wrote: 
> > ..and if you want more control over the look and feel of each item
> > and image, you might want to concider to use a custom CellRenderer.
> > 
> > Waldo
> 
> 
> Yahoo! Groups Sponsor
> ADVERTISEMENT
> click here
> 
> 
> ______________________________________________________________________
> 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.
* -- 
Alistair McLeod
Development Director
iteration::two


Reply via email to