Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    change canvas background dinamically

    when i try to change the background of canvas dinamically, i receive an advert wich says: "cannot change configuration property 'backgroundimage'". My question is there any way to change the background image dinamically in a canvas?
    I use this code to try to do that:
    canvas.setBackgroundImage("background.jpg");

    Thanks for your reply.

    #2
    That property should be settable and this has been corrected (will hit SVN in a few days). However, you're generally better of with a separate Img widget with 100% width and height, as a child of the Canvas.

    Comment


      #3
      thanks, I tried with the Img widget and works ok.

      Comment


        #4
        setBackgroundImage()

        Hi, I downloaded the latest SmartGWT zip file from SVN (2/3/10) and setBackgroundImage() no longer throws an exception when called after a Canvas is rendered. I can change the background image to a different one, but I cannot clear it. I use this technique in a TileGrid where I set the background to a watermark image and once the user drops an object onto it, I clear the watermark image from the background. I tried the following without success:

        tileGrid.setBackgroundImage("");
        tileGrid.markForRedraw();

        tileGrid.setBackgroundImage(null);
        tileGrid.markForRedraw();

        Comment


          #5
          Try pointing to a blank image.

          Comment


            #6
            Yes, I'm doing that as a work-around but I was hoping it would work correctly post-rendered. Thanks.

            Comment


              #7
              Workaround:

              private static class MyLabel extends Label {
              public MyLabel(String string) {
              super(string);
              }

              // Workaround for a SmartGWT bug
              public void setBackgroundImage(String backgroundImage) {
              setAttribute("backgroundImage", backgroundImage, true);
              }
              }

              Comment

              Working...
              X