Testing new screen API getitembyid() to retrieve a folder within a panel without traversing the complete hierarchy.

Testing new screen API getitembyid() to retrieve a folder within a panel without traversing the complete hierarchy. Doesn’t work as expected.

//Get the id of the folder

id=getEventScreen().getCurrentDesktop().getItemByName(“panel”).getContainer().getItemByName(“folder”).getId()

//Doesn’t open the folder by accessing the folder directly without traversing the hierarchy (which would be elegent)

getEventScreen().getCurrentDesktop().getItemById(id).open()

//Does open the folder. but is tedious and hard-coded hierarchy which I would want to avoid

getEventScreen().getCurrentDesktop().getItemByName(“panel”).getContainer().getItemByName(“folder”).open()

]]>

3 Commentsto Testing new screen API getitembyid() to retrieve a folder within a panel without traversing the complete hierarchy.

  1. Anonymous says:

    < ![CDATA[

    I confirm it should work with the “short” expression, I’ll look at this.

    ]]>

  2. Anonymous says:

    < ![CDATA[

    I just noticed something wrong in:


    getEventScreen().getCurrentDesktop().getItemById(id).open()


    getItemById will return null, because it will only looks in the container



    Use getEventScreen().getItemById(id).open() and it will work as expected because this version of getItemById returns the first item found in the container hierarchy (see also getAllItemsById)

    ]]>

  3. Anonymous says:

    < ![CDATA[

    That seems to work indeed. Cheers.



    So using getCurrentDesktop was narrowing the result from the beginning.

    ]]>

Leave a Reply

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