Been trying to set the color of a panel to the color of the open folder for a while now but keep getting a null…

Been trying to set the color of a panel to the color of the open folder for a while now but keep getting a null pointer exception on the commit.. Any body have any ideas???

var event = LL.getEvent();

var desktop = event.getContainer();

var flds = LL.getOpenFolders();

var fldLen = flds.getLength();

if (fldLen > 0) {

var fld3 = flds.getAt(0);

 var editor = fld3.getProperties().edit();

 var box = editor.getBox(“f.box”);

  var editor2 = desktop.getProperties().edit();

var box2 = editor2.getBox(“f.box”);

var color = box.getColor(“c”, “n”);

box2.setColor(“c”, “n”, color);

editor2.commit();

}

]]>
(Next Post) »

7 Commentsto Been trying to set the color of a panel to the color of the open folder for a while now but keep getting a null…

  1. Anonymous says:

    < ![CDATA[

    This is getting called from the panels position Changed event if that helps…



    And color is getting a value of -9961581

    ]]>

  2. Anonymous says:

    < ![CDATA[

    Might also be able to get by if I can change wallpaper tint via script… Anyone know if that’s possible?

    ]]>

  3. Anonymous says:

    < ![CDATA[

    You get the color from the PropertyEditor?



    Edit: try to use base 16 when you write colors, it’s easier to understand when one reads



    Are you sure event.getContainer() returns valid?



    Post more info on the error.

    ]]>

  4. Anonymous says:

    < ![CDATA[

    It must be something with the container…. I tried forcing the color to the pure green color in the example at http://www.pierrox.net/android/applications/lightning_launcher/script/reference/net/pierrox/lightning_launcher/script/api/Box.html and still get the error. I can change the folder color fine by using the same call but not the container….



    I’m fairly certain its the commit though since I put an alert in the line before and it gets called but then immediately errors.



    But again all I get is java.lang.NullPointerException at line ##. Which is no real help.

    ]]>

  5. Anonymous says:

    < ![CDATA[

    Try to use bgColor for containers not *f.box*

    ]]>

  6. Anonymous says:

    < ![CDATA[

    In fact there are two mistakes.



    The first is that you are acting on a Container object, but what you need is to work on the “Panel” object associated with the container. Instead of event.getContainer(); use event.getContainer().getOpener();


    That is a bit confusing because from the user menu you see only one object (a panel) whereas in script you have to manipulate two things, a panel and a container.



    The other small mistake is the extra use of an editor in “var editor2 = desktop.getProperties().edit();”, just use “var editor2 = desktop.getProperties()”

    ]]>

  7. Anonymous says:

    < ![CDATA[

    Pierre Hébert thanks for the help. I did play around with getOpener but the extra .edit stopped me from figuring it out.



    I also had to change the second f.box to an i.box… but I finally got it working. Thanks again!

    ]]>

Leave a Reply

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