  | |  | NumericStepper cell renderer: Question & Problem | NumericStepper cell renderer: Question & Problem
2004-02-16 - By Collin Peters
Back First my question: After you have set the cell renderer to be something
(such as a numeric stepper), how to you control that object? For
example, how do you set the minimum and maximum of the stepper?
Now my problem: I created this renderer by copying & pasting the example
for a checkbox. This worked fine except for some reason, the
NumericStepper creates more instances than needed. i.e. if I have 3
rows in my grid, it will create a stepper for rows below the three that
do not exist. These components disappear after I move my mouse over the
row. I put a trace on the _visible attribute in the setValue function,
and they ARE being set to not visible, but they are still showing. I
have posted the code below if anyone knows how to help.
Regards,
Collin
P.S. I had a h**l of a time trying to get the sizing to work with the
equation that came from the sample file, so I just hardcoded the
location in. If anyone knows the proper way to do that, it would be
appreaciated.
=======================================================================
import mx.core.UIComponent
import mx.controls.NumericStepper
class org.morpheusgroup.utils.NumericStepperCellRenderer extends UIComponent
{
var stepper;
var listOwner; // the reference we receive to the list
var getCellIndex; // the function we receive from the list
var getDataLabel; // the function we receive from the list
function NumericStepperCellRenderer()
{
}
function createChildren(Void) : Void
{
stepper = createObject( "NumericStepper ", "stepper ", 1,
{styleName:this, owner:this});
stepper.addEventListener( "change ", this);
size();
}
// note that setSize is implemented by UIComponent and calls size(),
after setting
// __width and __height
function size(Void) : Void
{
//stepper.setSize(150, 22);
//stepper._x = (__width-150)/2;
//stepper._y = ((__height-22)/2) + 3;
stepper._x = 0;
stepper._y = 8;
}
function setValue(str:String, item:Object, sel:Boolean) : Void
{
stepper._visible = (item!=undefined);
stepper.value = item[getDataLabel()];
}
function getPreferredHeight(Void) : Number
{
return 22;
}
function getPreferredWidth(Void) : Number
{
return 20;
}
function change()
{
listOwner.dataProvider.editField(getCellIndex().itemIndex,
getDataLabel(), stepper.value);
}
}
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Supported by Fig Leaf Software
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Be sure to check the archives and the wiki:
http://chattyfig.figleaf.com/
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
http://chattyfig.figleaf.com/cgi-bin/ezmlm-cgi?1:mss:104374
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
To unsubscribe send a blank e-mail to:
Normal Mode: flashcoders-unsubscribe@(protected)
Digest Mode: flashcoders-digest-unsubscrive@(protected)
|
|
 |