ImageGear Professional v18.2 > User Guide > Using ImageGear > Working with Events |
"Events" are the mechanism whereby ImageGear informs your application of external events (e.g., the user clicking the mouse, or pressing a key on the keyboard). An "Event Handler" is a subroutine in your application program that ImageGear calls when the Event occurs. Conceptually, it looks like this:
Your application can do anything it wants in the Event Handler subroutine. Typically, however, Event Handlers are used to coordinate the activities of various ImageGear ActiveX controls. For example, if you have an IGGUIThumbnailCtl Control displayed in your application's UI, and also an IGPageViewCtl Control, and you're using the IGGUIThumbnailCtl Control as a kind of "file chooser", then you'd want the user to be able to click on one of the thumbnails and have the image automatically displayed in the IGPageViewCtl Control. You'd define a "ClickIn" Event Handler for the IGGUIThumbnailCtl Control, and call LoadPageFromFile Method in the Event Handler subroutine.
The most commonly implemented Event Handlers are listed in the table below:
Control | Event | Usage |
---|---|---|
<all> | Error | One of the 4 mechanisms for Error handling. See Working with Error Handling. |
IGFormatsCtl Control | IGMetadataItemAdd Event IGMetadataItemRead Event IGMetadataItemWrite Event |
Only used for image files containing non-image data ("metadata"). These event handlers are called as the file is read or written. Use these to obtain the metadata (Read) or create the metadata (Add) or correct the metadata (Write). See Working with Non-Image Data. |
IGPageViewCtl Control | MouseDown Event MouseMove Event MouseUp Event |
MouseDown followed by MouseUp is a "click" in the image, which can be used to trigger some default image-related function your application. MouseMove can be used to track the mouse (e.g., to display that part of the image magnified). |
IGGUIThumbnailCtl Control | Click Event | Called to indicate that the user clicked somewhere within the thumbnail browser. |
IGArtXCtl Control | Called when toolbar buttons are clicked and when the toolbar is closed. | |
IGArtXCtl Control | Called for the various events in the "life" of an ART mark. For example, when the user presses the mouse button down as they begin to draw the mark, PreCreateNotify is called (your program can provide default mark values at this point). When the user releases the mouse button after drawing the mark, CreateNotify is called (your program can validate the mark and cancel it, if necessary, at this point). After the mark is created, PostCreateNotify is called (your program can react to the creation of the mark at this point). |