Pinning grid attached works differently via scripting vs other methods (the menu’s ‘pin’ option, and the ‘customize…

Pinning grid attached works differently via scripting vs other methods (the menu’s ‘pin’ option, and the ‘customize item’ ‘pin mode’ radio select). Via non-script methods, items are pinned to their current position in the view (vertically at least). This is as expected. Via scripts, items appear to be pinned at their position relative to the home screen / page. If they’re not on the home screen / page, this effectively causes them to vanish forever (or until unpinned via scripting, as there seems to be no other way to reach them…).

I tested using this simple, ‘item menu’ attached, script:

LL.getEvent().getItem().getProperties().edit().setString(“i.pinMode”, “XY”).commit();

]]>

3 Commentsto Pinning grid attached works differently via scripting vs other methods (the menu’s ‘pin’ option, and the ‘customize…

  1. Anonymous says:

    < ![CDATA[

    Go to general settings and uncheck ‘honor pinned items’. This will show the pinned items in edit mode as not pinned (the problem you have is that it is outside the main page and pinned, so you can’t see it)



    Workaround (not tested): run this code before you pin the item.



    var item = LL.getEvent().getItem();


    var itemParent = item.getParent();


    var x = itemParent.translateIntoScreenCoordX(item.getPositionX());


    var y = itemParent.translateIntoScreenCoordY(item.getPositionY());


    // if item is not on grid change setting


    item.getProperties().edit().setBoolean(“i.onGrid”, false).commit();


    // set position


    item.setPosition(x, y);


    // TODO: set scale according to zoom.

    ]]>

  2. Anonymous says:

    < ![CDATA[

    Michael Plotke Well. As you may notice, without the honor pinned items checked what you said is not working. It seems Pierre Hébert made that feature only with honor pinned items. I think we can suggest it to be available also with script, instead of write a custom one. Anyway seems that Bodgan made a good one.

    ]]>

  3. Anonymous says:

    < ![CDATA[

    When pinning an item on the screen, the user interface tries to make things so that the user is not surprised. In particular it will ensure the item stays visible after pinning. Unlike the user interface, the script won’t enforce this protection, but it does only what it is supposed to do.

    ]]>

Leave a Reply

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