X

Help Articles are product support tips and information straight from the NV5 Geospatial Technical Support team developed to help you use our products to their fullest potential.



3109 Rate this article:
No rating

Workaround for capturing mouse click events in an ENVI display window

Topic:

This article describes one method for capturing a mouse click event within an ENVI display window. This method is most useful if the mouse click event is supposed to relate to a change in focus within the display window (user clicks on a new location within the window). You are not capturing the mouse click directly, but instead capturing a change in cursor location within the window.

Discussion:

It is possible to capture ENVI mouse click events within a display window using documented routines -- however it is not straightforward. Here are the necessary steps:

  • Create a top level base widget that will not be visible to the user while your program is running.
  • Call WIDGET_CONTROL in the following manner: WIDGET_CONTROL, Widget_Id, TIMER=interval_in_seconds. Set the timer value to a small value (one second or less, perhaps). Every time that increment of time passes, the timer widget will fire off an event, which can be captured by another program which responds to the arrival of the event as if a mouse click was generated.


Note:
A timer widget event is identical to any other widget event except that it contains only the 3 standard event tags. These event structures are defined as:

{ WIDGET_TIMER, ID:0L, TOP:0L, HANDLER:0L }

It is left to the caller to tell the difference between standard widget events and timer events. The standard way to do this is to use a widget that doesn't normally generate events (e.g., a base or label). Alternately, the TAG_NAMES function can be called with the STRUCTURE_NAME keyword to differentiate a WIDGET_TIMER event from other types of events. For example:

IF TAG_NAMES(event, /STRUCTURE_NAME) EQ $
'WIDGET_TIMER' THEN ...


Using the TIMER keyword is more efficient than the background task functionality found in the XMANAGER procedure because it doesn't "poll" like the original background task code.

Please login or register to post comments.
Featured

End-of-Life Policy Enforcement for ENVI 5.3 / IDL 8.5 and Earlier Versions

5/6/2024

April 1, 2024 Dear ENVI/IDL Customer,  We are reaching out to notify you of our supported... more »

How to Upgrade licenses to ENVI 6.x / IDL 9.x

12/5/2023

What is the new Upgrade function? Starting with ENVI 6.0 and IDL 9.0, we have implemented an... more »

What to do if the 'License Administrator - License Server' for the Next-Generation License Server does not start?

6/13/2023

Background: With the release of ENVI 5.7 & IDL 8.9 and the corresponding Next-Generation licensing... more »

Next-Generation Licensing FAQ

4/28/2023

  NV5 Geospatial has adopted a new licensing technology for all future releases of our ENVI, IDL... more »

The IDL Virtual Machine

6/6/2013

What is the IDL Virtual Machine? An IDL Virtual Machine is a runtime version of IDL that can... more »