onViewerResize - event of the PmgRoot object
Description:
The event is triggered if panel window size is changed.
The event can be used, for example, 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 an object describing detailed information about the specific event.
pEvent.Dx - ( Long) [ for reading] New panel window size in X-axis (in pixels).
pEvent.Dy - ( Long) [ for reading] New panel window size in 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 the panel content is represented by the size of the
PmgRoot object. The panel 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 the panel window.
In this process the position and size of individual Pmg objects are not modified. Only the panel size is modified (without 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;
pMe.Dx = pEvent.Dx
pMe.Dy = pEvent.Dy
Example2:
Example of the 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.
JavaScriptVBScriptSelect and copy to clipboard
var nDx, nDy, oItem;
pMe.Dx = pEvent.Dx > pMe.IniDx ? pEvent.Dx : pMe.IniDx;
pMe.Dy = pEvent.Dy > pMe.IniDy ? pEvent.Dy : pMe.IniDy;
nDx = pMe.Dx - pMe.IniDx;
nDy = pMe.Dy - pMe.IniDy;
// The main central Pmg object (e.g. table) (t0) gets larger/smaller in defined direction:
oItem = pMe.Items("/t0");
oItem.Dx = oItem.IniDx + nDx;
oItem.Dy = oItem.IniDy + nDy;
// Pmg objects to the right from the table (e.g. buttons) (br0, br1) move horizontally:
oItem = pMe.Items("/br0");
oItem.X = oItem.IniX + nDx;
oItem = pMe.Items("/br1");
oItem.X = oItem.IniX + nDx;
// Pmg objects under the table (e.g. buttons) (bd0, bd1) move vertically:
oItem = pMe.Items("/bd0");
oItem.Y = oItem.IniY + nDy;
oItem = pMe.Items("/bd1");
oItem.Y = oItem.IniY + nDy;
pMe.Refresh();
Dim nDx, nDy, oItem
If pEvent.Dx > pMe.IniDx Then
pMe.Dx = pEvent.Dx
Else
pMe.Dx = pMe.IniDx
End If
If pEvent.Dy > pMe.IniDy Then
pMe.Dy = pEvent.Dy
Else
pMe.Dy = pMe.IniDy
End If
nDx = pMe.Dx - pMe.IniDx
nDy = pMe.Dy - pMe.IniDy
' The main central Pmg object (e.g. table) (t0) gets larger/smaller in defined direction:
Set oItem = pMe.Items("/t0")
oItem.Dx = oItem.IniDx + nDx
oItem.Dy = oItem.IniDy + nDy
' Pmg objects to the right from the table (e.g. buttons) (br0, br1) move horizontally:
Set oItem = pMe.Items("/br0")
oItem.X = oItem.IniX + nDx
Set oItem = pMe.Items("/br1")
oItem.X = oItem.IniX + nDx
' Pmg objects under the table (e.g. buttons) (bd0, bd1) move vertically:
Set oItem = pMe.Items("/bd0")
oItem.Y = oItem.IniY + nDy
Set oItem = pMe.Items("/bd1")
oItem.Y = oItem.IniY + nDy
pMe.Refresh