LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Detection of zoom start

Hello,

 

I'd like to use an indicator showing if one or two of the graph axes are scaled with respect to their original scale. Du to the present lack of an axis scale event (you may support my request here) I have tried different workarounds, without success.

 

  • I thought of using the EVENT_GOT_FOCUS to read the original scale, and after a zoom (which could also involve a restore or zoom out) read the axis scale again, and compare both values. Because the sequence of events is undefined (ZOOM may occur before GOT_FOCUS), this approach doesn't work.
  • In the graph control callback I also tried to check if the CTRL key is pressed (which is required for zooming). If so, I'd query the axis range. But it appears that the graph callback may be called after the zoom only... , i.e. the CTRL key query of the axis scale may report the zoomed scale...

If someone can provide useful insights or suggestions, please don't hesitate Smiley Happy

 

Of course I could query the axis range after each plot, but since I have several tens of possible plots this solution doesn't look very elegant.

 

Thanks!

0 Kudos
Message 1 of 4
(2,853 Views)

I'm not sure when it came in, but in CVI 2010 there is an EVENT_ZOOM.  Have you tried keying off of that?  I believe it fires after the user is finished with the zoom action.  In one of my projects I use it to get the new X and Y scales after the user has zoomed.

 

Edit:  Now I see that you're trying to detect when the user has started zooming.  I don't think my suggestion will work. 

0 Kudos
Message 2 of 4
(2,844 Views)

Thanks anyway! Yes, I am already using the EVENT_ZOOM. As it fires after the zoom it can't be used for this partuclar purpose, I guess.

0 Kudos
Message 3 of 4
(2,839 Views)

Just in case someone wanted to contribute but was missing some details, here is the schematics of the graph callback:

 

int CVICALLBACK Graph ( int panel, int control, int event, void *callbackData, int eventData1, int eventData2 )

{

// check if CTRL key is depressed ( required fro zoom action )

        UtilityGetKeyModifierStates ( &ctrl_modifier );
// if this is the first zoom action, obtain 'original' axis range

// does not work reliable because callback might be called after zoom

        if ( ctrl_modifier && ( zoom_step == 0 ) )
        {
            UtilityGetAxisRange ( panel, PANEL_GRAPH, VAL_LEFT_YAXIS, &y_minimum, &y_maximum );
        }
        switch ( event )
        {
            case EVENT_LOST_FOCUS:
// turn off cursor display

                break;
            case EVENT_MOUSE_POINTER_MOVE:
// obtain and display cursor coordinates

 break;
            case EVENT_MOUSE_WHEEL_SCROLL:

// zoom action

                break;

            case EVENT_RIGHT_CLICK:

// prepare and display popup menu
                break;
            case EVENT_ZOOM:
                switch ( eventData1 )
                {

//

                }
                break;
        }
    }
    return ( 0 );

0 Kudos
Message 4 of 4
(2,818 Views)