Questions about the custom view.

Questions about the custom view.

I have a script that returns a custom view, but I would like to use the same script in the paused and resumed events (to avoid multiple scripts)

How can I detect that? I know some ways, but which is the best and most reliable one?

Second: when you use item.getRootView() the returned view is the ‘launcher’ one, (with the box and such). I know it can be useful, but if you want to get the custom view, you need to run getChildAt(0) three times when attached to grid!

So, what about another function item.getView() which will return the custom view? (In case of other lightning item it will return the corresponding child view)

]]>

9 Commentsto Questions about the custom view.

  1. Anonymous says:

    < ![CDATA[

    I think the right way is to check for the existence of the LL.getEvent function, if it’s not there, then this isn’t an event.


    The getView method is here, but not on Item, on CustomView 😉

    ]]>

  2. Anonymous says:

    < ![CDATA[

    Oh! I missed it. Thanks 😀

    ]]>

  3. Anonymous says:

    < ![CDATA[

    Another question:


    When the creation script makes an error, the view is not created.


    What is the best/fastest/safest way of force it to be created again without restarting the launcher?

    ]]>

  4. Anonymous says:

    < ![CDATA[

    Yes, that’s annoying. The fastest would be an utility script:


    item.getProperties().edit().commit();


    (not tested but I believe it should work).


    I am thinking at a workaround: if no view has been set, display a button instead: tapping on it would start again the creation script? (a bit like widgets that cannot be loaded)

    ]]>

  5. Anonymous says:

    < ![CDATA[

    Pierre Hébert that would be the best solution, yes.

    ]]>

  6. Anonymous says:

    < ![CDATA[

    Testing with the getEvent function don’t work, it is there even in the creating script (I guess because I’m forcing it to be created again, not when the launcher is loaded)


    I’m using if(!(“getEvent” in LL)){




    However this seems to work (it seems that ‘item’ is so strange that typeof makes an error, lol)



    try{typeof item}catch(e){

    ]]>

  7. Anonymous says:

    < ![CDATA[

    Oh right, I tested this after a reload and this property is dynamically created but never cleared 🙁


    Don’t know why typeof fails!

    ]]>

  8. Anonymous says:

    < ![CDATA[

    What i do, is set the same script again in the CV_settings. But restart is nearly as quick.

    ]]>

  9. Anonymous says:

    < ![CDATA[

    Bytheway, on script-error the ‘view script’ takes me to the wrong script.

    ]]>

Leave a Reply

Your email address will not be published. Required fields are marked *