Hmmmm Replying on my own mail now...

Getting there slowly. To help others with this I'm posting my 
development.
It now works. There are some small issues with the focus; the 
NumericStepper that is selected the last is still enabled when 
selecting other components on the form.

The contents of NumericRenderer.as follows:

import mx.core.UIComponent
import mx.controls.NumericStepper
import mx.controls.Label;


class NumericRenderer extends UIComponent
{
        var stepper : NumericStepper;
        var myLabel : Label;
        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 createChildren(Void):Void
        {
                super.createChildren();
                createClassObject( Label, "myLabel", 1, {styleName:this, 
owner:this});
                createClassObject( NumericStepper, "stepper", 2, { 
styleName:this, owner:this, selectable:true, editable:true } );
                stepper.minimum = 1;
                stepper.maximum = 200;

                stepper.addEventListener("enter", this);
                stepper.addEventListener("change", this);
        }

        function layoutChildren() {
                stepper.setSize(layoutWidth, layoutHeight);
                myLabel.setSize(layoutWidth, layoutHeight);
        }

        function getValue(){
                return stepper.value;
        }

        function setValue(value, item:Object, selection:String):Void
        {
                if ( item == undefined )
                {
                  myLabel.visible = false;
                  stepper.visible = false;
                  return;
                }
                if ( selection == "normal" || selection == "highlighted" )
                {
                  stepper.value = item[ getDataLabel() ];
                  stepper.visible = false;
                  myLabel.visible = true;
                }
                else if ( selection == "selected" )
                {
                  myLabel.visible = false;
                  stepper.visible = true;
                  stepper.setFocus( false );
                }
        }

        function getPreferredHeight(Void) : Number
        {
                return stepper.getPreferredHeight();
        }

        function getPreferredWidth(Void) : Number
        {
                return stepper.getPreferredWidth();
        }

  function change()
  {
        listOwner.editField(getCellIndex().itemIndex, getDataLabel(), 
stepper.value);
        myLabel.text = stepper.value;
  }

  function enter()
  {
    if ( stepper.value != undefined )
    { 
          listOwner.editField(getCellIndex().itemIndex, getDataLabel(), 
stepper.value);
          myLabel.text = stepper.value;
    }
  }


        function focusOut() {
//              listOwner.editField(getCellIndex().itemIndex, 
getDataLabel(), stepper.value);
                //stepper.visible = false;
                //myLabel.visible = true;
                //editing = false;
        }

}





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/nhFolB/TM
--------------------------------------------------------------------~-> 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
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:
    http://docs.yahoo.com/info/terms/
 


Reply via email to