Problem referencing function children containers - noob question

I'm trying to highlight a list item in a list view when the user switches it. I get an error, which suggests that my function is not my container. I tried a bunch of different ways to reference the container by, I can't seem to find the solution.

Error: asset:///main.qml:114: ReferenceError: can't find variable: highlight

It happens in my setHighlight function. QML is as follows:

import bb.cascades 1.0

NavigationPane {
    id: navigationPane

    // auto-delete any page when popped from the NavigationPane
    onPopTransitionEnded: page.destroy()

    Page {

        Container {

            onCreationCompleted: _btController.deviceListing.discover()

            ListView {
                id: deviceList

                dataModel: _btController.deviceListing.model

                listItemComponents: [
                    ListItemComponent {
                        type: "listItem"

                        Container {
                            layout: DockLayout {
                            }

                            Container {
                                id: highlight
                                background: Color.Black
                                opacity: 0.1
                                horizontalAlignment: HorizontalAlignment.Fill
                                verticalAlignment: VerticalAlignment.Fill
                            }

                            StandardListItem {
                                title: ListItemData.deviceName
                                description: ListItemData.deviceAddress
                                status: ListItemData.deviceRSSI
                            }
                        }
                    }
                ]

                function setHighlight(highlighted) {
                    if (highlighted) {
                        highlight.opacity = 0.5;
                    } else {
                        highlight.opacity = 0.0;
                    }
                }

                onTriggered: {
                    deviceList.toggleSelection(indexPath);
                    setHighlight(ListItem.selected)
                }
           }
        }
    }
}

Hello

That you reference ListItem.selected in ListView {}, but there is no there.

It is only available on the element root of ListItemComponent.

Something like this should work (untested):

ListItemComponent {
  type: "listItem"
  Container {
    id: rootItem
    layout: DockLayout {}
    Container {
      background: Color.Black
      opacity: rootItem.ListItem.selected ? 0.5 : 0.0
      horizontalAlignment: HorizontalAlignment.Fill
      verticalAlignment: VerticalAlignment.Fill
    }
    ...

...

onTriggered: {
  deviceList.toggleSelection(indexPath);
}

Select the element is a special case, but if you need to update the properties other than the selection, do not reference ListItemComponents directly. There may be multiple instances of a component and they are not guaranteed to exist, so they cannot be referenced by id from outside. All changes must be made by dataModel. In components bind to dataModel values.

Tags: BlackBerry Developers

Similar Questions

  • Noob question: Playbooks all have the same performance?

    I know... noob question. I am to complete my first game PlayBook and before I submit the app store I wanted to make sure that hardware performance will be the same on all the playbook or will it be something because of the performance issues on a per-device basis? I hope that this will be similar to a console where you can expect stable performance. THX.

    All devices (currently) work the same in the same conditions.

    That does not mean, however, that you can treat it as a console.  A console runs only a game and nothing else (in general).

    The PlayBook can run multiple applications, and among other things, a user can 'Behavior of the Application' setting configuration Mode Showcase, default, or standby, what determines if your application runs or stops when it is idle.  If they are in window mode, they may have other things at the same time.

    To a first approximation, however, "even in the world" is probably correct, for now.  Don't forget there will be different tablets in the future, with specification different but compatible with your app... not quite like a console there where many games is basically orphaned (or requires a port) when a new generation comes out.

  • Noob question: autonomous AIR .bar files?

    Sorry for the noob question, yet to learn these things from the air. When we create a .bar file, it is the only file position, does it include the runtime air, flash, etc, etc, or is it always require an accumulation of air / flash runtimes on the device? THX.

    The .bar file does not include the time of execution because the runtime is already preinstalled on the Playbook.

    Air is really integrated into the PlayBook so you don see the difference between a native app or an Air application.

  • NooB question: Cup titles and a schedule of transfer

    Let's say I have tons of tracks.  In the Middle, I find I want to firm up a few seconds of footage.  I can cut, or delete the clip, but I still have to select all the following clips and make sure they move upward.  There must be a smarter way of removing a few seconds of footage and moving upward?

    Sorry for the noob question, I searched on google and didn't know what to look for.  I am open for more information that can help me to tighten my research thus.  See you soon.

    The answer will probably depend on more factors:

    Are there in your Timeline, Clips above the area of the Clip you want to Trim?

    What you want to happen to those?

    Are you only concerned to "strengthen" the Clips on the same video track where you cut, or Clips on other tracks video too?

    It is likely that the tool Edit Ripple, or Rt-click and Ripple delete, will do what you want, but who can count on the other Clips on other tracks, and video that you need.

    Good luck and please let us know a little more.

    Hunt

  • D.I. box noob question

    Hi all

    Sorry for the noob question, but I need something clear up if possible. I was about to buy a box for injection and then had a query on them, and if I actually could benefit in this scenario...


    Fig 1. is how I currently record.

    Fig 2. is how I would do it with di direct box

    diag.jpg

    My question is... in this configuration, the d.i. box would make a difference to the signal? or he would only make a difference if I was going to live guitar to box, the sound card?

    Thank you for all your help.

    In my opinion you have basically three alternatives for the recording of the guitar:

    1. get an amp excellent sound, recording with a microphone, or more, in a room of good survey.

    Challenges: you'll probably need a studio proper, or at least no neighbours, because it could become LOUD. It takes time and experience of mike a good amp and even microphones expensive (several). Result depends on the acoustics of the room more than you think.

    Another way here, is to get/build an isolation area around your amp, which will be a kind of micro studio for it, allowing you to play hard and with a good tone, but in a more controlled environment. Many advantages for this make. Unfortunately, the expense can also be 'pro' - but I don't know there are DIY solutions.

    2. record of the amp 'dry' via either its line (send FX will also) or use a ' soaking power allowing you to put the amp (some sounds so much better AMPS), but with a low volume in the room. You can connect the device of soaking directly, or give the speaker the "tame" signal and mike the amp without disturbing the neighbors that it now. Good power soaks don't come cheap (?). Dry recording, for example by not using mike, often sounds like this: dry. It depends on your style of music, but an electric guitar should probably be considered an acoustic instrument. Instead of a diaphragm in wood, it has a speaker. The sound, often, we want to achieve is an amp of good sounding in a good room, which is an acoustic sound. You simply cannot get to an exit row or direct to a soaking of output power (not president). He needs treatment.

    3 use a program like GuitarRig, Amplitube etc. No installation required, regardless of the size of the room and acoustic sound (except that the acoustics of the room always will affect listening!) or mike. The software simulates the amps, effects and even mic configurations; added the "airplane" that you will not get a direct connection. Once again, according to your style. If I were Bill Frisell or Jim Hall, i.e. anyone with an as most of their music very "naked" guitar sound, I probably does (but these guys have access to the great engineers too...), but in a pop idom / mixed rock with other instruments and certainly to do demos, that's actually what I would recommend. Especially for us space challenged who have neighbors and an infinite time either. No, you will not look like 'all the world'; It's garbage in French - garbage out as always (many are disappointed by the present, but some are happy, it is always the case)

    All you need is a sound card with an instrument of entry. If you have a * good * sound card already who is not entered instrument, you can consider a DI box. Otherwise I'd say it's redundant.

  • Noob question: problem loading jQuery

    Hi all, I have created flash panels Photoshop years ago and now try the HTML5 stuff.  I use Photoshop CC 2014 on Windows 8.1.

    I'm just trying to get a VERY simple operational sample jQuery but for some reason any jQuery refuses to load.  Now, I probably don't do things in the right order, etc, but I have tried all night to make it work:

    C:\Users\Gear\AppData\Roaming\Adobe\CEP\extensions\com.example.jqui\index.html

    <!DOCTYPE html>
    <html>
    <head>
    <script src="./js/libs/jquery-1.11.1.min.js"></script>
    <script>
    $(document).ready(function(){
      $("button").click(function(){
        $("p").hide();
      });
    });
    </script>
    </head>
    <body>
    
    
    <h2>This is a heading</h2>
    <p>This is a paragraph.</p>
    <p>This is another paragraph.</p>
    <button>Click me</button>
    
    
    </body>
    </html>
    
    

    This is an example of jQuery on W3:

    http://www.w3schools.com/jQuery/tryit.asp?filename=tryjquery_hide_p

    I have install the manifest.xml and .debug files, the extension is recognized by Photoshop, no problem and works fine but the example does not seem to load jQuery.  When I debug the extension in Chrome, it says:

    Eception ReferenceError: $ is not defined (index.html, line 6)

    I have triple checked the path to jQuery and it's OK, I even use the full path of the legs of fasteners auto.

    Any help would be GREATLY appreciated!

    Thank you!

    G

    BINGO!

    So I got a sample project from one of the CEP examples that worked well, so I was looking at the differences between the projects, one of them was the jQuery version...

    I loaded jquery - 1.9.1.js instead of jquery - 1.11.1.min.js in my project and it worked fine!

    In addition, I don't know what the problem is, however.

    G

  • Alert on the noob - question on function?

    Salvation day very early for me in Flex (no Java either!).

    I have a function to obtain data from a Web service that works very well. However, I'd like put some parts of the result in a public variable. It seems to me do it in the wrong place, but I don't know how corrrectly. The line that me travels upward in the following code is "userName = SessionMgr.sessionLogin.lastResult.getItemAt (0) .first_name. The error indicates that lastresult is null.
    BTW, I can get the lastResult relevant points to be displayed in a TextArea OK.
    TIA :-)

    < mx:Script >
    <! [CDATA]
    Import mx.states.State;
    public var userName:String
    private void clickHandler(event:MouseEvent):void {}
    switch (currentState)
    {case "loggedIn":}
    currentState = ";
    codeEntry.text = ";
    passwordEntry.text = ";
    break;
    by default:
    SessionMgr.sessionLogin.send (codeEntry.text, passwordEntry.text)
    userName = SessionMgr.sessionLogin.lastResult.getItemAt (0) .first_name
    currentState = 'loggedIn '.
    break;
    }
    }
    []] >
    < / Mx:Script > text

    The noob has figured out - he had to learn the async stuff and the manipulation of the results

  • Noob question on uneven with sides horizontal arrangement using CSS containers

    I can easily make layouts css horizontal with container into the container when the parent container is a strip of equal height to the Summit on the attached example. I wonder how to provision low scratched on the example attached, which is the color of background with different heights. Usually, the bottom of the container in the middle is an image file and the sides are thoroughly with the image of html colors.

    I don't know if there are web sites with this provision, but if there I'd love to check out them and if there is a tutorial would be great.

    I hope I make sense

    differentHeightSides.jpg

    When the text size is increased in browsers, text will reverse the fixed size containers. Use height min instead of the height.

    I think that the best you can do is create two divisions side by side and add a margin-top to the container on the left side.  See my example built with not only a CSS grid system:

    http://ALT-Web.com/notjustagrid/uneven-containers.html

    Nancy O.
    ALT-Web Design & Publishing
    Web | Graphics | Print | Media specialists
    http://ALT-Web.com/
    http://Twitter.com/ALTWEB

  • Windows 8 problem with functionality of keyboard backlight radiance on HP envy 17

    Hello

    I upgraded my laptop HP Envy 17 to Windows 8.

    I went and applied all the updates driver provided here for use with Win8.

    The question (more than one gene) implies the radiance keyboard.

    Start-up lighting of the keypad is disabled. When I press the F5 key, the lighting of the keypad is disabled.

    When I press the button once again, lighting is turned on.

    Is there a setting (Panel or registry) I can modify to prevent that from happening.

    Thank you.

    EWO

    Hello Eyes - Wide - Open and jdubs. I understand that after your update of Windows 8 by pressing f (x) keys activate their functions Fn + F (X) instead of their main functions in f (x). Is this correct?

    Restart your laptop and enter the BIOS. Go to the section 'System Configuration '. You have enabled or disabled 'key Support Action '?

    When this option is simply to press the F key to activate action Fn + F (X). When it is disabled, you need to press Fn + F (X) for it to work. You want to disable it.

    After disabling and save your changes, restart the computer once more and then check if the problem has been resolved.

    Could Mslopar, you post your complete product for me number? Use this document to locate it.

    I hope everyone has a great day.

  • problem with function getCharIndexAtPoint

    Hello

    I encountered a strange problem using; It is a simple code that works well:

    package

    {

    import flash.display.Sprite;

    import flash.events.MouseEvent;

    import fl.text.TLFTextField;

    import flash.text.TextFieldType;

    import flash.geom.Rectangle;

    import flashx.textLayout.elements.Configuration;

    import flashx.textLayout.elements.TextFlow;

    import flashx.textLayout.conversion.TextConverter;

    import flashx.textLayout.conversion.ConversionType;

    public class scrollV extends Sprite

            {

    private var tlf:TLFTextField = new TLFTextField;

    private var str:String = "click on this text field. Compare the ' + '.

    ' difference between clicking without «+»»

    'selection versus clicking and selecting text.';

    public function scrollV()

               {

    var config:Configuration = TextFlow.defaultConfiguration;         

    config.manageTabKey = true; / / activate the tab key

    addChild (tlf); tlf.width = 200;

    tlf.text = str;

    tlf.wordWrap = true;

    tlf.type = TextFieldType.INPUT;

    tlf.addEventListener (MouseEvent.CLICK, printCursorPosition);

    trace (TextConverter.export (tlf.textFlow, TextConverter.TEXT_LAYOUT_FORMAT, ConversionType.STRING_TYPE) as String);

                }

    printCursorPosition(e:*):void private function

                {

    trace ("tank #:", tlf.caretIndex + "from:", tlf.selectionBeginIndex + "to:", tlf.selectionEndIndex);

    var rett:Rectangle = tlf.getCharBoundaries (tlf.caretIndex);

    trace ("char pos:" + rett.x +', ' + rett.y);

    trace ("idx #:" + tlf.getCharIndexAtPoint (rett.x, rett.y));

               }

           }

    }         

    In this code, the function getCharIndexAtPoint works properly; then I wanted to try the same function but using textFlow and, using the export trace output, I wrote the following code:

    package

    {

    import flash.display.Sprite;

    import flash.events.MouseEvent;

    import fl.text.TLFTextField;

    import flash.text.TextFieldType;

    import flash.geom.Rectangle;

    import flashx.textLayout.elements.Configuration;

    import flashx.textLayout.elements.TextFlow;

    import flashx.textLayout.conversion.TextConverter;

    import flashx.textLayout.conversion.ConversionType;

    import flashx.textLayout.container.ContainerController;

    public class scrollV extends Sprite

       {

    private var tlf:TLFTextField = new TLFTextField;

    private var str:String = '< TextFlow columnCount = "inherit" +

    "columnGap ="inherit"+"

    "columnWidth ="inherit"' + '.

    ' lineBreak = "explicit" paddingBottom = "inherit" +.

    "paddingLeft ="inherit"' + '.

    "paddingRight ="inherit"paddingTop ="inherit "+".

    "renderingMode = 'normal' ' +"

    "verticalAlign ="inherit"+"

    "whiteSpaceCollapse ="preserve"' +"

                                             'xmlns=" http://ns.Adobe.com/TextLayout/2008 "> '+

    ' < p > < span renderingMode = "inherit" > "+

    "Click on this text field. Compare the difference '.

    "between clicking without selecting ' + '.

    "versus clicking and text selection. '" +

    ' </span > < / p > ' +.

                                             '</TextFlow>';

    scrollV() of the public service

              {

    var config:Configuration = TextFlow.defaultConfiguration;         

    config.manageTabKey = true; / / activate the tab key

    addChild (tlf); tlf.width = 200;

    tlf.textFlow = TextConverter.importToFlow (str, TextConverter.TEXT_LAYOUT_FORMAT);

    control of the var: ContainerController = new ContainerController (tlf);

    tlf.textFlow.flowComposer.addController (control);

    tlf.textFlow.flowComposer.compose ();

    tlf.textFlow.flowComposer.updateAllControllers ();

    tlf.wordWrap = true;

    tlf.type = TextFieldType.INPUT;

    tlf.addEventListener (MouseEvent.CLICK, printCursorPosition);

    trace (TextConverter.export (tlf.textFlow, TextConverter.TEXT_LAYOUT_FORMAT, ConversionType.STRING_TYPE) as String);

               }

    printCursorPosition(e:*):void private function

              {

    trace ("tank #:", tlf.caretIndex + "from:", tlf.selectionBeginIndex + "to:", tlf.selectionEndIndex);

    var rett:Rectangle = tlf.getCharBoundaries (tlf.caretIndex);

    trace ("pos:" + rett.x +', ' + rett.y);

    trace ("idx #:" + tlf.getCharIndexAtPoint (rett.x, rett.y));

               }

         }

    }         

    in this code the getCharIndexAtPoint function gives the error #1009: cannot access a property or method of a null object reference.

    Does anyone know how to tell me where the error in this code?

    Thank you for all.

    1 TLFTextField is a kind of Sprite (extends Sprite). So, your solution makes sense anyway. I suggest that you first ask the question again on the Sub-Forum related to Flash pro (or Flash authoring), because TLFTextField is under their control, rather than TLF.

    2. more than details on TLF, you can see its codes, the docs and examples in http://sourceforge.net/adobe/tlf/home/

    How to implement * getCharIndexAtPoint *.

    TLF cursor may return its own position, which can also present the index of the char.

    Example Code:
    textFlow.interactionManager = new SelectionManager();

    textFlow.interactionManager. activePosition

    textFlow.interactionManager. anchorPosition

  • Problems updating to version 12.0 question + 64 - bit

    On the first question: my Firefox 11.0 will refresh by 12.0, even when you browse the path "about Firefox-> check updates". I know that the release date for 12.0 was today, so I don't understand what the problem is.

    On the second question: is it true that, since version 13.0, there will be a 64-bit version of Firefox? If so, users will be able to choose to upgrade to 64-bit before the update 12-13?

    Time of release 12 Firefox on demand (subject to change) is 8: HAP to the United States this time has not yet arrived from this response. Adjust right there at your local time.

    The 64-bit version of Firefox may not occur for several months yet. Currently, there is a test at night (14 of Firefox) version, the less stable/secure level and should be installed by users very experienced for the test only. Plugins in 64-bit by third-party developers are still quite rare.

    If this answer solved your problem, please click 'Solved It' next to this response when connected to the forum.

    Not related to your question, but...

    You may need to update some plug-ins. Check your plug-ins and update if necessary:

  • HP FIRST: function Inverse on the question of the HP Premium

    Hello

    I was wondering if anyone new how to find the inverse of a function expression on the HP Premium algebriac.

    This can be done on the Casio Class Pad using the inversion function. Watch the video link below.

    https://www.YouTube.com/watch?v=8jSKf8OJaW4

    So may my question a similar thing is done on the FIRST HP.

    Concerning

    Arthur Rappos

    The forum said that my image upload is "pending approval".  I hope it shows up soon.  If not, here's a link to it on my web server: http://holyjoe.net/images/isolate.png

    In the meantime, you can find the inverse function of almost no matter what there simply by solving this equation of x using the command solve in CASE.  This is sometimes referred to as "isolation x".  For example, if y = 1 + 2 / x, you can find the inverse function in case of premium by typing this:

    Solve(y=1+2/x,x)

    This isolates the x the other side of the equation, which gives us x = 2 /(y-1), which shows the inverse function, we were looking for.

    The command solve can insulate almost any variable from almost any equation.  It is very powerful.

  • Satellite C850 - 1-5 - problem with function keys

    Good evening

    Since a few days, I noticed on my laptop that I could not do more as before, which is the volume with the button located at the top of the keyboard (F9 - F10) or the brightness. On the square, it's functions F1, F2, F3 etc. who went. I have already tried using parameters and setting key 'special functions' systems, but that worked again, then in "mode F1 - F12", still nothing and I challenged 'special functions', but again without success.

    How to solve this problem, please?

    Can you please tell us what model of laptop do you have?

  • Problem with function "BD" in TestStand/LabWindows

    Hello, good day.

    I am having some problems with connection BD function I use in a personal function inside a DLL.

    I had a function called GetSensor , which I know it works because I have used and tested in the LabWindows environment.

    Its function is to return the value of an element in my database to give its input parameter, just that.

    My problem comes out when I tried to use this same feature in TestStand, it seems that the BD can only function in the same way of when used of LabWindows because always display a warning message, which is display only when the values of iHdbc are iHdbc is 11 or iHdbc is 10.

    The software that I use are:

    I know that TestStand is the opening of my DLL locks function it always enter, but failed the part then try to connect to the database.

    I think that this could be a problem of compatibility with LabWindows, TestStand, but I can't find where I can change some options to solve this problem.

    Thanks in advance. Any help you could give is welcome.

    I coud not answer before.

    The solution to my problem with the BD connection function should use NI TestStand 2014 (32-bit) instead of the version of NI TestStand 2014 (64-bit) that I used. Just that.

  • Problem with function "BD" in LabWindows/TestStand

    Hello, good day.

    I am having some problems with the connection BDfunction.

    I had a function called GetSensor , which I know it works because I have used and tested in the LabWindows environment.

    Its function is to return the value of an element in my database to give its input parameter, just that.

    My problem is that when I tried to use this same feature in TestStand, it seems that the BD can only function in the same way of when used of LabWindows because always display a warning message, which is display only when the values of iHdbc are iHdbc is 11 or iHdbc is 10.

    The software that I use are:

    Thanks in advance. Any help you could give is welcome.

    The solution to my problem with the BD connection function should use NI TestStand 2014 (32-bit) instead of the version of NI TestStand 2014 (64-bit) that I used. Just that.

Maybe you are looking for