Promotic
WikipediaLinkedInYoutubeTwitterFacebook

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 object describing detailed information about the specific event.
pEvent.Action - (Long) Action type by the left mouse button.
0 - releasing the button
1 - pressing the button
2 - double-clicking the button
pEvent.Ctrl - (Boolean) Indication of concurrent pressing the Ctrl key.
pEvent.Shift - (Boolean) Indication of concurrent pressing the Shift key.
pEvent.Alt - (Boolean) Indication of concurrent pressing the Alt key.
pEvent.FocusIn - (Boolean) 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) X-axis position of the mouse cursor relative to the upper-left 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. when clicking into the left outline the X coordinate is negative).

pEvent.Y - (Long) Position of the mouse cursor in the Y-coordinate 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. when 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 it 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 but always 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 calling 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: Added new pEvent.FocusIn parameter.
PROMOTIC 9.0.13 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