Promotic
WikipediaLinkedInYoutubeTwitterFacebook

onMousePress - event of object PmiItem

Description:
The event fires on pressing, releasing or double-clicking the left mouse button on the graphic item. The fact if the event has been fired by pressing, releasing or by double-clicking can be obtained from the pEvent.Action parameter.
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.Action - (Long) Action type over the left mouse button.
0 - releasing the left mouse button
1 - pressing the left mouse button
2 - double-clicking the left mouse 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) Identification whether the item gained focus by pressing.
false - The item had focus before pressing.
true - The item gained focus by this pressing.
pEvent.X - (Long) X-axis position of the mouse cursor relatively to the upper-left corner of the item (in pixels). For items with border (see the configurator "Border - width") 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 relatively to the left upper corner of the item (in pixels). For items with border (see the configurator "Border - width") 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 will be called only if the Control enabled configurator is checked.
- This event is also functional for Web Panels.
- This event is not functional for graphic item: PmiRoot, PmiAx.
 

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 when the user presses or releases the mouse button, then the onMousePress event fires 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, 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 by the left mouse button click. Right mouse button click (i.e. calling the context menu) can be managed by the onMenuFill event. Middle mouse button click is not supported for event calling so far.
See also:
Example:
If pEvent.Action = 0 Then
  ' do something when the mouse button is released
  If pEvent.Ctrl Then
    ' if moreover the Ctrl key has been pressed, do even something more
  End If
End If
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice