Passing Arguments to a custom CellRender

I am creating a simple two marked list by creating two areas of label labels using a class called TwoLabelCell that extends AlternatingCellRenderer and looks like this:

package views
{
  import flash.text.TextFormat;

  import qnx.fuse.ui.listClasses.AlternatingCellRenderer;
  import qnx.fuse.ui.text.Label;

  public class TwoLabelCell extends AlternatingCellRenderer {
    private var description:Label;
    private var labelFormat:TextFormat;
    private var text:String;

    public function TwoLabelCell(labelText:String) {
      this.text = labelText;
    }

    override protected function init():void {
      super.init();

      labelFormat = new TextFormat();
      labelFormat.color = 0x777777;
      labelFormat.size = 17;

      description = new Label();
      description.x = 17;
      description.y = 33;
      description.format = labelFormat;
      description.text = text;

      this.addChild(description);
    }
  }
}

Remember that this is just a test at the time, so I'm working with a single label (once I tell myself on this issue, I'll add the other and use the same logic). The main idea here is that when I call, he will define the text variable that will be used to change the text of the label on the list, when it is created. Now, this is the main file for the application:

package {
  import flash.display.Sprite;

  import qnx.fuse.ui.events.ListEvent;
  import qnx.fuse.ui.listClasses.List;
  import qnx.fuse.ui.listClasses.ListSelectionMode;
  import qnx.fuse.ui.listClasses.ScrollDirection;
  import qnx.ui.data.DataProvider;

  import views.TwoLabelCell;

  [SWF(height="600", width="1024", frameRate="30", backgroundColor="#FFFFFF")]
  public class PackTrack extends Sprite {
    private var packList:List;

    public function PackTrack() {
      super();

      initializeUI();
    }

    private function initializeUI():void {
      packList = new List();
      packList.setPosition(0, 0);
      packList.width = 310;
      packList.height = 400;
      packList.rowHeight = 50;
      packList.selectionMode = ListSelectionMode.SINGLE;
      packList.scrollDirection = ScrollDirection.VERTICAL;

      var arrMonth:Array=[];
      arrMonth.push({label: "January"});
      arrMonth.push({label: "February"});
      arrMonth.push({label: "March"});
      arrMonth.push({label: "April"});
      arrMonth.push({label: "May"});
      arrMonth.push({label: "June"});
      arrMonth.push({label: "July"});
      arrMonth.push({label: "August"});
      arrMonth.push({label: "September"});
      arrMonth.push({label: "October"});
      arrMonth.push({label: "November"});
      arrMonth.push({label: "December"});

      packList.dataProvider = new DataProvider(arrMonth);
      packList.cellRenderer = new TwoLabelCell("Testing Label");

      packList.addEventListener(ListEvent.ITEM_CLICKED, onListClick);

      this.addChild(packList);
    }

    private function onListClick(event:ListEvent):void {
      trace("Item clicked: " + event.data.label);
      trace("Index clicked: " + event.index);
    }
  }
}

When I try to run I get this error:

Error: skin must be Class or String
    at qnx.fuse.ui.listClasses::List/set cellRenderer()[E:\hudson\workspace\GR2_0_0_AIR_SDK_API\src\qnxui\src\qnx\fuse\ui\listClasses\List.as:1069]
    at PackTrack/initializeUI()[/Users/Nathan/Documents/Adobe Flash Builder 4.6/AIRTest/src/PackTrack.as:46]
    at PackTrack()[/Users/Nathan/Documents/Adobe Flash Builder 4.6/AIRTest/src/PackTrack.as:19]

Any idea on how to fix this (preferably without using MXML)?

PS: I'm learning Flex (from Java)

The API is looking for a class, not an object, when you set the cellrenderer property.

The cell rendering engine has a data property you can inspect for the label data.

This property is populated by the data provider of the list.

To add your 2nd custom label you can create it as a property of your data provider object

elements of the array.  Something like:

arrMonth.push({label: "January", customlabel: "Custom label text"});
arrMonth.push({label: "February", customlabel: "Custom label text"});

The data provider is an array of objects of value Object literals (which can be object literals) with

You can set the properties.  The class expects a property called label, but you can add your own

Properties of the object here.

Then in the display of your cell, you can reference

this.data.customlabel

to get the data of the custom label.

Tags: BlackBerry Developers

Similar Questions

  • Passing arguments to a custom class of MC constructor

    I have problems with the Builder for a custom class linked to a MovieClip library.

    I have a MovieClip in my library called circle, which is related to the com.shapes.Circle class. I want the contstructor of class circle to take 2 arguments, xScale and yScale:

    public function Circle (xScale:Number, yScale:Number) End Sub

    However, if I try to call it from code, for example ball circle = new Circle (3.14,2.0); , I always get a 'number of Incorrect arguments. Waiting 0 " error.

    Is it possible to have a custom class linked to a MovieClip that can take arguments, or Flash not allow this? I had asked about this before and thought I figured out, but look at it now, I apparently had not thought of it and has resorted to a workaround sloppy; I'm hoping to fix now.

    Library items cannot have constructor arguments, because the user can drag on the stage and in this way has no way of passing arguments. If you wat to initialize instances, define public void init() where you can add as many arguments as you want.

  • You need to pass arguments to the Sub - VI which runs in parallel to the main vi.

    Please help me.

    I can pass arguments to a subvi using "call-by-reference-node" but the sub - vi will not work in parallel.  I can also run my sub - vi in parallel using "invoke the node", but then cannot pass arguments.  I can't understand how to merge these two concepts.

    When I open the reference VI, I specify the strict type, using call-by-reference-node.  When I use call node, I don't specify the type.  It seems that specifying the type strict guard screw run in parallel, but also seems necessary to pass arguments.

    I apologize for my absence of a deeper understanding of this and appreciate any help you can give me.

    Chris

    You must invoke 'Ctrl Val.Set' node.

  • Passing arguments to the script

    Hello

    I have created a dialog box load the files in the folder and when I click the button I run another script of command StartScript (...)

    How can I pass arguments to the script (the paths of files)?

    Thank you

    Hey OzShimon,

    As long as you use a tiara predefined global variables (T1, T2,...)  you'd be fine. You can also define user variables (.) SAV files) or even to declare your own global variables with: call GlobalDim ("Myname").

    These variables are not re-initialized until you restart the script engine. So just change 'obj' for T1 your test should work

    ' Dim obj

    Void Button1_EventClick (ByRef This)

    T1 = "Hello World".

    Call ScriptStart("C:\Users\Oz\Desktop\test.vbs")

    End Sub

    * the script code (test.vbs):

    Call MsgBox (T1)

    Kind regards

    Javier

  • How to passing arguments to an exe

    Hai Everbody

    I know that LabVIEW has the ability to call an exe file created in different platform, can I know how to pass arguments to the special exe (which is located in another platform) via LabVIEW... I wish someone could help me out of this

    Thanks for your answers, I found the solution... As the exe is in .net, I used the syntax for the command line arguments in .net...

  • How to pass arguments to the SQL Script in command prompt

    I don't know about the ' & nom_de_variable "to request a value in the command line.

    But, how can I pass arguments from the command line for the following script to the command - prompt

    Example:

    ex_proc. SQL

    CREATE OR REPLACE PROCEDURE ex_proc (employee_id NUMBE IN)
    IS
    v_emp_id Number (38);
    BEGIN

    v_emp_id: = employe_id;

    UPDATE emp_employee SET sal = 2000 WHERE emp_id = v_emp_id;

    END;
    /


    call_ex_proc. SQL

    Appellant for procedure above:

    BEGIN

    ex_proc (100); -The employee id is 100.

    END;
    /

    Here are the General controls that we use to run the scripts above-

    SQL > @ex_proc.sql

    SQL > @call_ex_proc.sql



    But my requirement is to pass the employee id as an argument in the command line as.
    SQL > @call_ex_proc.sql 100

    Is it possible to pass command line arguments?

    Usually this question start with reading documentation, wouldn't it?

    Solomon Yakobson showed you the method gross and unreadable.

    You will use best

    set = '& 1' '.

    -use & in the rest of the code

    ----------
    Sybrand Bakker
    Senior Oracle DBA

  • Custom components and passing arguments

    This afternoon I got a great response on the use of custom MXML components and calling a function in the main file of the application. I can do it now using parentDocument, BUT I need to pass the name of a function (for filtering) as a parameter of the function call in the custom component. Here are two code fragments.

    Custom component code

    " < mx:LinkButton label = '10% discount or more" (showTenPercent) click = "parentDocument.filterFunction" / >

    The main application code

    public function filterFunction(functionName:Function):void {}

    merchantDG.visible =true;

    merchantData.filterFunction = functionName;

    merchantData.refresh ();

    }

    public Function showTenPercent(item:Object):Boolean {}

    return (item.merchantOfferCategory ==' 10% ');

    }

    The filterFunction in main application function is called by multiple components, so I think I should keep centralized in the main application. There is probably another way to do it, but I build my Flex skills slowly and need to understand how to proceed. As the code is now, I get an error on the functions and strings.

    I think instead of calling the function inside the custom component, you must do this from the inside of your main application whenever you are initiating the custom component.

    for ex.

    in this way, that you need not prefix parentDocument.

  • It is possible to pass arguments to a VI uses "Open VI reference.

    I am modifying pre-existing code. (I say this, because there are many other ways to work around this problem, but I'm stuck with what I have)

    I have a large project that is compiled into an EXE file.

    Within this project, it uses the 'Open VI reference' in VI that is bundled in the compiled exe file.

    All good, no?

    Well, here's the question:

    Is it possible to include arguments of open type of command line with a "reference VI"?

    Where I can say "Something.vi / Option: Foo".

    I tried many variants such as

    ' Something.vi-/ Option: Foo ".

    even tried variations such as

    "C:\MyLVProgram.exe\Something.vi Option:Foo".

    (Interestingly, quite there no error when you do "C:\MyLVProgram.exe\Something.vi" when executing the VI reference opened.)

    This exe is deployed in a system that has only installed the runtime.

    My current environment is LV 8.6.1. (I know it's old)

    It seems that the antiderivative of LabVIEW recognizes only the paths, and in all other cases, I get an error

    Error 1026 to invoke the node in Something.vi-> MakeSomething.vi

    Possible reasons:

    LabVIEW: VI Reference is not valid.

    Any ideas?

    You can only send command line arguments to an executable with the system Exec.  If you want to pass data in VI, then use the asynchronous call with run.

  • How to pass arguments to JVM containing spaces on Solaris

    How to pass the value of the JVM Argument containing spaces on Solaris?

    For example, I need to run tests of cucumber and pass the following JVM argument:

    -Dcucumber.options = "features - classpath:com glue, company, projects, steps"

    But I get the following error:

    Unrecognized option:-glue

    Could not create the Java virtual machine.

    Seems that the space after "features" is recognized as a delimiter, even if I put the value in quotes.

    Everything works fine on Windows, but fails on Solaris 5.10.

    Any ideas?

    Thank you.

    Problem is solved. The cause was illogical in quotes in Shell.

    This does not work, she same product works the same string on Windows:

    CUCUMBER_OPTIONS = "-Dcucumber.options =-" $FEATURES_PATH - fit $STEPS_PATH\ "" "

    JVM_OPTIONS = "$CUCUMBER_OPTIONS $OTHER_OPTIONS".

    $JAVAHOME/bin/java org.junit.runner.JUnitCore com.company.project.runner.TestRunner $JVM_OPTIONS

    While this is the case, even the value $FEATURES_PATH-$STEPS_PATH glue is not quoted:

    CUCUMBER_OPTIONS = "glue-Dcucumber.options = $ FEATURES_PATH-$STEPS_PATH.

    JVM_OPTIONS = $OTHER_OPTIONS.

    $JAVAHOME/bin/java '$CUCUMBER_OPTIONS' $JVM_OPTIONS org.junit.runner.JUnitCore com.company.project.runner.TestRunner

  • Pass arguments (Parameters) of the data form for HBR

    Hello

    My HBR is triggered when the form data is saved, and my requirement is that members used in the Page POV should be passed to the HBR as an argument or parameter. Please let me know the steps to achieve this. What changes to make in the form of data both on the HBR.

    Your suggestions will be appreciated and thanks in advance.

    KR

    Well, how about you read this:
    http://camerons-blog-for-Essbase-hackers.blogspot.com/2009/06/why-i-hate-and-love-business-rules-part.html

    And then this:
    http://camerons-blog-for-Essbase-hackers.blogspot.com/2009/06/why-i-hate-and-love-business-rules-part_17.html

    I don't know that the real docs describe how to do as well.

    Kind regards

    Cameron Lackpour

  • question about passing arguments

    I want to just make sure it's fair from what I understand. Within the legacy, the data type passed as arguments to the method must be of the reference type. Example is shown below
    class A { }
    class B extends A {
    1. A x = new B();  // x is a *reference variable* of class A and it points to( refer to) an *object* of class B
    2. blabla(x)           // invoke a method below
    3. public void blabla(A y)
    }  
    In line 3, the argument type must be A.otherwise, the compiler will complain
    However, if we change the code a bit:
    class A { }
    class B extends A {
    1. B x = new B();           // x is a *reference variable* of class B and it points to( refer to) an *object* of class B
    2. blabla(x)                    // invoke a method below
    3. public void blabla(A x) 
    }  
    The code still works too because the type of x is B and B's, then we can say that x is A legacy when switching from x to the blabla (a x) method.
    Please correct me if I make a mistake. I understand that

    Published by: starting on October 27, 2010 12:47 AM

    I think you're on the right track, OP. However, you will get ploymorphic real powers of your method of blabla() if it has been defined in class a. rather than be defined in the B class.

  • How to pass arguments to a manufacturer of components

    Hello, I need a little help. I created the new components in flash builder, and I don't know how to give arguments to its constructor. If create a new component named "MyComponent", I would like to pass some of the arguments, something like:

    var myComponent1:myComponent = new myComponent (myAgrument);

    I usually do with the as3 classes, but I don't know how to do with flex components.

    Thx for the help

    Max

    Yes, something like

    SerializableAttribute public class MyClasss extends group

    {

    private var var1:MyCustomType;

    public void MyClass(arg:MyCustomType)

    {

    var1 = arg;

    }

    }

    HTH,

    C

  • Pass arguments of variable length to an another variable length arguments

    Do not pass an argument of variable length to another argument of variable length

    For example

    public void call(name:String,..._params):Object

    {

    ExternalInterface.call("saveglobalscore",score) (name, params);
    }

    call ("test", "param1");

    "param1" is considered to be an argument with the type of array in the second function of «call», but is what I want to treat it as an argument as a string.

    The result is:

    < call name = 'test' returntype = "xml" > < arguments > <table > <property id = '0' > < name String > < / string > < / property > </ array > </ arguments > < / call >

    But what I want is

    < call name = 'test' returntype = "xml" > < arguments > < String > name < / String > < / arguments > < / call >

    I have to do is:

    public void call(name:String,..._params):Object

    {

    If (params.length == 1)

    {

    ExternalInterface.call("saveglobalscore",score) (name, params [0]);

    } Else if (params.length == 2)

    {

    ExternalInterface.call("saveglobalscore",score) (name, params [0], params [1]);

    } Else if (params.length == 3)

    {

    ExternalInterface.call("saveglobalscore",score) (name, params [0], params [1], [2] params);

    } else

    throw new Error ("I'm crazy");

    }

    This is a terrible solution, if it no work around?

    The compiler must can handle this situation.

    Try:

    public void call(name:String,..._params):Object

    {

    params.unshift (Name);

    ExternalInterface.call.apply (ExternalInterface, params);

    }

    Alex Harui

    Flex SDK Developer

    Adobe Systems Inc..

    Blog: http://blogs.adobe.com/aharui

  • passing VARs to the custom context menu

    I created a custom off a vbox component. Within the vbox I declared a Public Variable can be bound as indicated
    [Bindable]
    Public var dv_jobid:String;

    I want to launch the component in a pop-up window when double-clicking on a datagrid control. I call the function to create
    the popup and here is the code for this function. The popup is created, but when I include the code to pass a value to my public var I get error of undefined property. IV been on it for two hours, ridiculous!

    Im sure it's simple, why I do not get this?

    VR;
    public var viewjob:jobDetailView = new components.jobDetailView;

  • Design example of a different process pocess and passing arguments

    Creating instance of process of a different process:

    I have two different processes: Main_Flow (id: MainFlow) and Second_Flow (id: SecondFlow). In the first process, I read a csv file. Each line of the file contains four columns. After reading each line, I open the Second_Flow and pass the data read from the file. (Pls find the code below for the whole process):
    fileReader = FileReader(arg1: fullFileName); filename is a file type and file name and path
    Java.Io.BufferedReader reader = BufferedReader(arg1: fileReader);

    String str;
    countLines int = 0;

    While ((str = reader.readLine ())! = null)
    {
    strColumn = str.split (delim: ",");

    int ColumnCnt = 0;
    While (ColumnCnt, 4)
    {
    definition of variables
    String appNo;
    String custNo;
    String loanAmm;
    String loanDate;
    logMessage ("the column value:"+ ColumnCnt + "is" + strColumn [ColumnCnt] ');
    If (ColumnCnt == 0)
    {
    arrLoanData ['appNo'] = strColumn [ColumnCnt];
    }
    Else if (ColumnCnt == 1)
    {
    arrLoanData ['custNo'] = strColumn [ColumnCnt];
    }
    Else if (ColumnCnt == 2)
    {
    arrLoanData ['loanAmm'] = strColumn [ColumnCnt];
    }
    ElseIf (ColumnCnt == 3)
    {
    arrLoanData ['loanDate'] = strColumn [ColumnCnt];
    }
    arrLoanData ["descriptionArg"] = "AutoInstance:" + formatTime (timeStyle 'now',: Time.SHORT); "."
    arrLoanData ['genByArg'] = 'auto ';

    ProcessInstance.create (processId: "/ SecondFlow", arguments: arrLoanData, argumentsSetName: "BeginIn");

    ColumnCnt = ColumnCnt + 1;
    }
    countLines = countLines + 1;
    }

    (' The code is in Java and not PBL ")

    I spend appNo, custNo, loanAmm, and loanDate as arguments. The Argument will be of any type [string]. The argument the name of Second_Flow is "BeginIn". But I don't get anything in Second_Flow.

    What can I do in the mapping of the beginning of Second_Flow argument for the argument past (table)?

    the argument "arguments" for the ProcessInstance.create method receives a map of the arguments that the value of the "argumentSetName" argument will receive.
    so, for example, if your second stream has 2 arguments, String name, decimal value and content String() your method call would be:
    ProcessInstance.create (processId: "/ SecondFlow", arguments: {"name": strNameFromCsv, "value": valueFromCsv, "content": ["a", "b", "c", "d"]}, argumentsSetName: "BeginIn");

Maybe you are looking for

  • How to pin a site that is pinned offscreen?

    I installed my version of Firefox. In the latest version, I got a few pinned sites at the bottom of the new tab page. After the upgrade, one of the sites disappeared from the page. When I try to rearrange the sites on this subject, it appears hidden

  • make the partition of SL disk image and restore to another hard drive

    Hi, I have partitioned my hard drive, a mountain lion other snow leopard partition. My goal is to put now the partition with snow leo on it's own hard drive and delete a partition on the original hard drive. Could someone point me in the right direct

  • Satellite A100-290 (PSAA8) LAN driver cannot be installed

    Hello together! I just bought a Satellite A100 - 290 (PSAA8) and tried to install the Ethernet controller and network with no result. Prof. WinXP can't find the driver. I downloaded the Chipset utility, installed, but this is not enough. I still have

  • How to limit the date and the option to change via gpo

    Hello I would like to limit domain users should not change the time and date by GPO. Can anyone help on this. -Souloumiac.

  • Copy several files to the command prompt

    I want to create a batch file copy several files that I specified a directory and use a command once. but when I tried to 'copy file1 + file2 + file3 destDir', it copies only the first file. I do not copy all of the files or the files whose names sha