Announcement

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

    Canvas in CanvasItem not destroyed

    Hi,

    I have a CanvasItem which I pass an Img in.
    When the Form is destroyed, the Img itself isn't.
    Do I need to manage that myself?

    case:
    Code:
    String fieldName = "fieldX";
    String imageURL = "[SKINIMG]/actions/approve.png";
    
    DynamicForm form = new DynamicForm();
    form.setTitleOrientation(TitleOrientation.TOP);
    form.setTitleSuffix("");
    form.setNumCols(2);
    
    CanvasItem myImg = new CanvasItem();
    myImg.setCanEdit(true);
    myImg.setCanvas(new Img(imageURL));
    myImg.setShowTitle(false);
    myImg.setName(fieldName + "_image");
    
    TextItem text = new TextItem();
    text.setShowTitle(false);
    text.setName(fieldName);
    
    form.setFields(myImg, text);
    
    final HLayout container = new HLayout();
    container.setMembers(form);
    
    Button d = new Button("destroy");
    d.addClickHandler(new ClickHandler() {
    	
    	public void onClick(ClickEvent event) {
    		container.destroy();
    	}
    });
    
    VLayout layout = new VLayout();
    layout.setWidth(300);
    layout.setHeight(300);
    layout.setMembers(container, d);
    return layout;
    attached screenshot: before and after hitting destroy


    FireFox 4 - gwt dev mode
    SmartClient Version: SNAPSHOT_v8.3d_2012-04-04/Pro Deployment (built 2012-04-04)
    Attached Files

    #2
    Hi,
    just checking if this is a bug or bad usage of me?

    Comment


      #3
      Hi Levi,
      We're looking at exposing a flag to have custom Canvases auto-destroy with their CanvasItems in the near future, but for now you will have to destroy the Canvas yourself.

      Regards
      Isomorphic Software

      Comment


        #4
        I also noticed this, migrating to 3.1d from 2.5.

        Another difference, calling button.setDisable(true) in a button inside a CanvasItem does'nt work anymore. Any idea how can I achieve this?

        Comment


          #5
          disable() the CanvasItem as a whole and the button it contains is automatically disabled.

          Comment


            #6
            Just a quick note to let you know that we've added an API 'setAutoDestroy()' to CanvasItem to cause the canvas to be automatically destroyed when the form item is destroyed.
            This feature will be in 3.1d branch builds going forward.

            Comment

            Working...
            X