Promotic
WikipediaLinkedInYoutubeTwitterFacebook

onViewerResize - event of object PmgRoot

Description:
The event is triggered if panel window size is changed. The event can be used for changing the position and size of Pmg objects based on the current panel window size.
Parameters:
pMe(Object) Reference to the PmgRoot object where the event rises.
pEvent(Object) Reference to object describing detailed information about the specific event.
pEvent.Dx - (Long)New panel window size of X axis (in pixels).
pEvent.Dy - (Long)New panel window size of Y axis (in pixels).
Note:
In this event, it is possible to adapt the size of the panel itself or the individual Pmg objects to the current panel window size. The size of panel content is represented by the size of the PmgRoot object. The panle size change can be done by changing the values Dx and Dy of the PmgRoot object.
 
This event is also functional in Web panels.
Example1:
An example of the event content. The panel size is adapted to current size of panel window. In this process the position and size of individual Pmg objects are not modified. Only the panel size is modified (wihout scrollbars). For changing position and size of selected Pmg objects, these must be modified individually.
JavaScriptVBScriptSelect and copy to clipboard

pMe.Dx = pEvent.Dx;
pMe.Dy = pEvent.Dy;
Example2:
Example of event content. The panel size and position of some Pmg objects is adapted to the current panel window size. The panel has its defined minimal size defined in the graphics editor when panel is created. If the panel window gets smaller, then scrollbars will appear. But if the panel window gets bigger, then the size and position of some Pmg objects will be changed as follows:
- The main central Pmg object (e.g. table) (t0) - gets larger/smaller in defined direction
- Pmg objects to the right from the table (e.g. buttons) (br0, br1) - move in horizontal direction
- Pmg objects under the table (e.g. buttons) (bd0, bd1) - move in vertical direction
JavaScriptVBScriptSelect and copy to clipboard

var dx, dy, item;

pMe.Dx = pEvent.Dx > pMe.IniDx ? pEvent.Dx : pMe.IniDx;
pMe.Dy = pEvent.Dy > pMe.IniDy ? pEvent.Dy : pMe.IniDy;

dx = pMe.Dx - pMe.IniDx;
dy = pMe.Dy - pMe.IniDy;

item = pMe.Items("/tb0");
item.Dx = item.IniDx + dx;
item.Dy = item.IniDy + dy;

item = pMe.Items("/br0");
item.X = item.IniX + dx;

item = pMe.Items("/br1");
item.X = item.IniX + dx;

item = pMe.Items("/bd0");
item.Y = item.IniY + dy;

item = pMe.Items("/bd1");
item.Y = item.IniY + dy;
pMe.Refresh();

History:
Pm8.03.00: Created
PROMOTIC 9.0.7 SCADA system documentation - MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice