Promotic
WikipediaLinkedInYoutubeTwitterFacebook

onModeChange - event of object PmiItem

Description:
The event fires when the graphic item mode changes. This may be such change that should cause some graphic item visual reaction. The following attributes of graphic item are now being observed:
- visibility
- forbidden control
- focus
- hovering mouse cursor over the item
.
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.NewValue - (Long)New value with graphic item state. The states of observed attributes are stored as individual bits. The value with set bit is stored in hexadecimal syntax (JavaScript).
0x0001 (bit 0) - The bit indicates that the graphic item is not visible (is hidden). See property Visible.
0x0002 (bit 1) - The bit indicates that some parent of the graphic item is not visible (is hidden).
0x0010 (bit 4) - The bit indicates that the graphic item is disabled. See property Enabled.
0x0020 (bit 5) - The bit indicates that some parent of the graphic item is disabled.
0x0100 (bit 8) - The bit indicates that the graphic item has focus (for keyboard control). See property Focus.
0x1000 (bit 12) - The bit indicates that the mouse cursor is hovering over the graphic item. See property MouseOn.
0x2000 (bit 13) - The bit indicates that the mouse cursor is hovering over some embedded graphic item.
Note:

In the PmiRoot graphic item, this event is called only for the value pEvent.NewValue = 0x0010 (i.e. when this item is disabled or enabled).

 
This event is also functional for Web Panels.
 
This event can be used for creating active graphic item that react to mouse movement, or keyboard input by changing their graphic properties. This can be used, for example, in the PmiCanvas object, where this can be used to design single state or multi state buttons. In this event, for example, the colour can be changed based on the mouse cursor hovering over the item, the item is enbled/disabled, the item has focus, etc.
See also:
Example:
Change of PmiPanel item background color based on the fact that the item or its parents are enabled/disabled (0x30 = item 0x0010 + parent 0x0020).
Example for VBScript language:
If pEvent.NewValue.Type And &H30 Then
  pMe.ColorItem = "#808080";
  pMe.ColorItem = "#C0C0C0";
Example for JavaScript language:
if (pEvent.NewValue.Type & 0x30)
  pMe.ColorItem = "#808080";
  pMe.ColorItem = "#C0C0C0";
... or
pMe.ColorItem = (pEvent.NewValue & 0x30) ? "#808080" : "#C0C0C0";
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice