- Code: Select all
/*
January 15, 2008
by Dean Westover
give default value of 8 for globals.fontSize
(or use whatever font size you want to start with)
give default value of 101 for globals.zoom
do give a name property to all elements that should be re-sized
do NOT give a name property to elements that should not to be re-sized
attach the following form method to a "Zoom-In" button on your form
*/
for ( var i = 0 ; i < elements.length ; i++ )
{
//return height and width
var w = elements[i].getWidth();
var h = elements[i].getHeight();
//set height and width
elements[i].setSize(w*globals.zoom/100,h*globals.zoom/100);
//return X and Y location
var x = elements[i].getLocationX();
var y = elements[i].getLocationY();
//set X and Y location
elements[i].setLocation(x*globals.zoom/100,y*globals.zoom/100);
//return font size
globals.fontSize = globals.fontSize * globals.zoom/100;
//set font 'fontname,style,size'
//style = (plain=0, bold=1, italic=2, bold-italic=3)
elements[i].setFont('Tahoma,0,' + globals.fontSize);
}
Any suggestions for enhancing or improving the above code are welcome. Attached is a sample Servoy 3.5.3 solution.
Dean Westover
Choices Software, Inc.