Exposed argName. Public for now, wire up a getter/setter if it ever needs the complexity.

git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@739 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Bruno Garcia
2008-12-12 22:29:52 +00:00
parent 9d6a5f0a4a
commit 7ecec007c8
@@ -35,19 +35,23 @@ import com.threerings.util.CommandEvent;
*/
public class CommandComboBox extends ComboBox
{
/**
* The attribute of the selectedItem object that used as the argument to the
* command or function. If null, the entire selectedItem is passed as the argument.
*/
public var argName :String;
/**
* Create a command combobox.
*
* @param cmdOrFn either a String, which will be the CommandEvent command to dispatch,
* or a function, which will be called when changed.
* @param argName The attribute of the selectedItem object that used as the argument to the
* command or function. If null, the entire selectedItem is passed as the argument.
*/
public function CommandComboBox (cmdOrFn :* = null, argName :String = "data")
{
CommandButton.validateCmd(cmdOrFn);
_cmdOrFn = cmdOrFn;
_argName = argName;
this.argName = argName;
addEventListener(ListEvent.CHANGE, handleChange);
}
@@ -72,14 +76,12 @@ public class CommandComboBox extends ComboBox
{
if (this.selectedItem != null) {
CommandEvent.dispatch(this, _cmdOrFn,
(_argName != null) ? this.selectedItem[_argName] : this.selectedItem);
(this.argName != null) ? this.selectedItem[this.argName] : this.selectedItem);
}
}
/** The command (String) to submit, or the function (Function) to call
* when changed, */
protected var _cmdOrFn :Object;
protected var _argName :String;
}
}