Announcement

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

    Customized button item question

    Hi,

    We are having a problem to change the width/height of our customized button item: if we change the width/height before drawing it, the changed value won't apply after the drawing.

    If it is a regular button, we can change the width/height correctly before drawing it.

    Is there anyway we can change the width/height of a customized button item before drawing it? We are using SmartClient v8.3p_2013-07-25/PowerEdition. Thanks!

    Please check the following code:

    1. Click the "Alter&Draw Custom Button" to draw the customized button. The width/height change doesn't apply.

    2. Click the "Alter&Draw Original Button". The width/height change applies.

    Code:
    isc.ClassFactory.defineClass("CwButtonItem", "CanvasItem");
    isc.CwButtonItem.addProperties({
        init:function () {
            var canvasProperties = {
                    ID: this.widgetID,
                    width: this.width,
                    height: this.height,
                   autoDraw: this.autoDraw,
                   icon: this.icon,
                   title: this.title
                };
            this.canvas = isc.Button.create(canvasProperties);
            this.title = ""; 
            return this.Super("init", arguments);
        }
    });
    
    isc.Button.create({
        title: "Alter&Draw Custom Button",
        width: 150,
        click: function() {
      testButton.setWidth(50);
      testButton.setHeight(50);
      testButton.redraw();
       myForm.draw();
    }
    });
    
    isc.Button.create({
        title: "Alter&Draw Original Button",
        left: 200,
        width: 150,
        click: function() {
      testButton2.setWidth(50);
      testButton2.setHeight(50);
      testButton2.draw();
    }
    });
    
    isc.DynamicForm.create({
    ID: "myForm",
    width: 100,
    height:20,
    top: 50,
    autoDraw: false,
    fields: [ { 
        widgetID: "testButton",
        width: 100,
        height: 20,
        autoDraw: false,
        icon: "icons/16/icon_add_files.png",
        _constructor: "CwButtonItem"
    }
    ]
    });
    
    isc.Button.create({
        ID: "testButton2",
        title: "",
        top: 50,
        left: 200,
        width: 100,
        height: 20,
        autoDraw: false,
        icon: "icons/16/icon_add_files.png",
    })

    #2
    Thanks for the test case. We see the problem and are making a change to address this.
    Please try the next nightly build (Dated Aug 10 or above), 9.0p or 9.1d branch

    Regards
    Isomorphic Software

    Comment


      #3
      Thanks for the quick fix! We are just wondering if this fix will be on 8.3 since currently we are not able upgrade to 9.x.

      Comment


        #4
        It happens to be straightforward, so we've ported this across to 8.3 as well.

        Regards
        Isomorphic Software

        Comment


          #5
          Thanks! It works fine now for our case.

          Comment

          Working...
          X