setZoom

Syntax

static int setZoom (int n)

Arguments

n
Lets you specify a zoom factor from 1 to 16. A value of -888 sets the default zoom that shows the whole image.

Return

Returns true if it succeeded and false if the current zoom factor is identical with the n parameter.

Description

Lets you set the zoom factor of the preview directly from code. But be warned! Only use setZoom in the OnCtl and OnFilterStart handlers, otherwise you will get some unwanted effects in the preview!

Example 1

%ffp

ctl(1): "Preview Zoom", Range=(1,16)

OnFilterStart:
{
  setZoom(ctl(1));
  return false;
}

Example 2

%ffp

// Puts a 100% button next to the
// default zoom control
ctl(100): PUSHBUTTON, "100%", Pos=(150,164), Size=(30,10) 

OnCtl(n):
{
  // Clicking the button sets
  // the preview window to 100%
  if (n == 100) setZoom(1);
  return false;
}

See Also

scaleFactor

Comments

Everyone can add his comments about his experiences with this function here. Tips for using it are welcome, too.