LUALoriotPro WEB site

LoriotPro scripting documentation
Extensions for LUA language

Table of contents Search function

Print the current page Mail this  link UTUBE Channel version française

lpav.SizeInRectAllSelected - Set a group of object in a rectangle

LoriotPro has extended the LUA sripting language by providing its own LUA libraries. The new functions provided are dedicated to the creation of monitoring and SNMP automation application.

Syntax

number=lpav.SizeInRectAllSelected(x,y,x1,y1);

Description

Set the position and size of a selection rectangle and auto scale the objects within this rectangle

Remark

The rectangle coordinates should be correct and the width (x1>(x+5)) or high (y1>(y+5)) greater than 5. Due to the conversion from double to integer the precision is not very good but the function remains very useful.

Parameters

x,y - The coordinate of the uper left corner of the rectangle. the Active View Area
x1,y1 - The coordinate of the lower right corner of the rectangle

Return Values

number - The number of objects moved.
result=1 if ok, nil if error

Example

lp_value = 0;
lp_buffer ="error";

dofile(lp.GetPath().."/config/script/loriotinit.lua");

zz=LPAV_OBJ_ANALOGIC_METER_01;

k=0;
lpav.Insert(10,1,10,10,zz);
lpav.SetClipart( lp.GetPath().."/card/vumeters/vumeter8.emf");
lpav.SetSelected();
lpav.Insert(20,1,20,20,zz);
lpav.SetClipart( lp.GetPath().."/card/vumeters/vumeter12.emf");
lpav.SetSelected();
lpav.CopyAllSelected();
lpav.RefreshMap();
lp.Break("pause");

lpav.DeleteAll();

lpav.ClearAllSelected();
lpav.Paste(0);
lpav.SizeInRectAllSelected(3,3+0, 3+20,3+20+0);
lpav.RefreshMap();
lp.Break("pause");

lpav.ClearAllSelected();
lpav.Paste(0);
lpav.SizeInRectAllSelected(3,3+20, 3+30,3+20+20);
lpav.RefreshMap();
lp.Break("pause");

lpav.ClearAllSelected();
lpav.Paste(0);
lpav.SizeInRectAllSelected(3,3+40, 3+40,3+20+40);
lpav.RefreshMap();
lp.Break("pause");

lpav.ClearAllSelected();
lpav.Paste(0);
lpav.SizeInRectAllSelected(3,3+60, 3+50,3+20+60);
lpav.RefreshMap();
lp.Break("pause");

lpav.ClearAllSelected();
lpav.Paste(0);
lpav.SizeInRectAllSelected(3,3+80, 3+60,3+20+80);
lpav.RefreshMap();
lp.Break("pause");

lp_buffer ="ok";
lp.Trace("fin");
lpav.RefreshMap();

 



www.loriotpro.com