Promotic

onMousePress - event of the PmgObject object

Description:
The event is triggered after pressing, releasing or double-clicking the left mouse button on the Pmg object.
Parameters:
pMe(Object) Reference to the PmgObject object where the event rises.
pEvent(Object) Reference to the object describing detailed information about the specific event.
pEvent.Action - (Long) [for reading] Action type by the left mouse button.
0 - releasing the button
1 - pressing the button
2 - left mouse button double-click
pEvent.Ctrl - (Boolean) [for reading] Indication of concurrent pressing the Ctrl key.
pEvent.Shift - (Boolean) [for reading] Indication of concurrent pressing the Shift key.
pEvent.Alt - (Boolean) [for reading] Indication of concurrent pressing the Alt key.
pEvent.FocusIn - (Boolean) [for reading] Indication whether the object gained focus by pressing.
false - The Pmg object had focus before pressing.
true - The Pmg object gained focus by this pressing.
pEvent.X - (Long) [for reading] Position of the mouse cursor on X-axis relative to the left upper corner of the Pmg object (in pixels).
For Pmg objects with border (see the "Border width" configurator) the position is counted from this border (i.e. by clicking into the left outline the X coordinate is negative).
pEvent.Y - (Long) [for reading] Position of the mouse cursor on Y-axis relative to the left upper corner of the Pmg object (in pixels).
For Pmg objects with border (see the "Border width" configurator) the position is counted from this border (i.e. by clicking into the upper portion of the frame, the Y coordinate is negative).
Note:
- This event is triggered only if the "Control enabled" configurator is checked.
- This event is also functional in Web panels.
- This event is not functional for object: PmgRoot, PmgActiveX.


Caution 1: It is always necessary to check the pEvent.Action property (see Example).
If property wasn't checked, then the script in the onMousePress event would be called twice because if the user presses or releases the mouse button, then the onMousePress event is triggered twice (each time with the different pEvent.Action parameter).
Caution 2: It is NOT advisable to place methods that call another window on the workspace (e.g. Pm.InputBox, etc.), into the script when the pEvent.Action=1 action is treated.
If such method is used, then it can result in the consequently NOT calling the pEvent.Action=0 action. Scripts that call other windows must be places into the treatment of the 0 action value.


This event is triggered only after pressing the left mouse button.
Right mouse button click (i.e. calling the context menu) can be managed in the onMenuFill event.
Middle mouse button click is not supported for event triggering so far.
See also:
Example:
JavaScriptVBScriptSelect and copy to clipboard

if (pEvent.Action == 0)
{
// do something if the mouse button is released
if (pEvent.Ctrl)
{
// If moreover the Ctrl key has been pressed, then do even something more
}
}

History:
Pm8.03.06: New pEvent.FocusIn parameter.
PROMOTIC 9.0.27 SCADA system documentation MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r.o.