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.
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",
})
Comment