Promotic
WikipediaLinkedInYoutubeTwitterFacebook

onViewerResize - event of object PmiRoot

Description:
The event fires if panel window size is changed (panel viewer). The event can be used for changing the position and size of graphic items based on the current panel window size.
Parameters:
pMe(Object) Reference to the graphic item where the event rises.
pEvent(Object) A referrence 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 graphic items to the current panel window size. The size of panel content is represented by the size of PmiRoot graphic item. The panle size change can be done by changing the values Dx and Dy of the PmiRoot graphic item.
 

This event is also functional for Web Panels.

Example1:
An example of the event content.
Example for VBScript language:
pMe.Dx = pEvent.Dx
pMe.Dy = pEvent.Dy
Example for JavaScript language:
pMe.Dx = pEvent.Dx;
pMe.Dy = pEvent.Dy;
Example2:
Example of event content. The panel size and position of some graphic items is adapted to the current panel window size. The panel has its defined minimal size defined in the panel editor when panel is created. If the panel window gets smaller than that, scrollbars will appear. But if the panel window gets bigger, the size and position of some graphic items will be changed as follows:
- the main central item (e.g. table) (t0) - gets larger/smaller in defined direction
- items to the right from the table (e.g. buttons) (br0, br1) - move in horizontal direction
- items under the table (e.g. buttons) (bd0, bd1) - move in vertical direction
Example for VBScript language:
Dim dx, dy, item
If pEvent.Dx > pMe.IniDx Then pMe.Dx = pEvent.Dx Else pMe.Dx = pMe.IniDx
If pEvent.Dy > pMe.IniDy Then pMe.Dy = pEvent.Dy Else pMe.Dy = pMe.IniDy
dx = pMe.Dx - pMe.IniDx
dy = pMe.Dy - pMe.IniDy
Set item = pMe.Items("/tb0")
item.Dx = item.IniDx + dx
item.Dy = item.IniDy + dy
Set item = pMe.Items("/br0")
item.X = item.IniX + dx
Set item = pMe.Items("/br1")
item.X = item.IniX + dx
Set item = pMe.Items("/bd0")
item.Y = item.IniY + dy
Set item = pMe.Items("/bd1")
item.Y = item.IniY + dy
Example for JavaScript language:
pMe.Dx = pEvent.Dx > pMe.IniDx ? pEvent.Dx : pMe.IniDx;
pMe.Dy = pEvent.Dy > pMe.IniDy ? pEvent.Dy : pMe.IniDy;
var dx = pMe.Dx - pMe.IniDx;
var dy = pMe.Dy - pMe.IniDy;
var 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;
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice