Need help with a script handler for interactiveViewChange('zoomarea')

 From:  ed (EDDYF)
10403.1 
Hi Michael -

I need help using interactiveViewChange('zoomarea') within a script.

I have tried various event handlers inside my ZmArea() function to proceed after interactiveViewChange('zoomarea') is finished.

The only way I have found that allows interactiveViewChange('zoomarea') to finish is to add a "Continue" button that allows the script to progress when clicked.

I'd like to not use a Continue button and have the script to proceed automatically when the user releases the mouse after drawing the zoom rectangle. Is that possible?

Ed Ferguson

code:
<html xmlns:moi>
	<head>
		<link rel="stylesheet" href="moi://ui/moi.css" type="text/css">
		
<script>
  // _TestZoomArea.htm
			
  moi.ui.mainWindow.viewpanel.mode = '3D';
	
	
function Main()
{
moi.ui.alert( 'Do main stuff here - then Zoom Area' ) ;
// do main stuff
//
// Zoom Area
ZmArea();
//
//
moi.ui.alert( 'Finish doing more main stuff here' ) ;
// more main stuff	
}
	
			
function ZmArea()
{
	moi.ui.mainWindow.viewpanel.getViewport('3D').interactiveViewChange('zoomarea');
					
	    while (1)
	    {	
			moi.ui.commandDialog.waitForEvent();
					  
			if ( moi.ui.commandDialog.event === 'continue' ) {
               return;
            }
		
	     }
}

</script>
	
</head>
	
	<body class="commandbody">
		<div style="text-align:center; font-weight:bold;">
			Test Zoom Area
		</div>
		<div class="commandoptions">
			<table style="width:100%" cellspacing="0" cellpadding="0">
				<tr>
					<td><moi:PushButton class="SlimBtn" id="startbutton" onbuttonclick="Main();">Start Test</moi:PushButton></td>
					<td><moi:PushButton class="SlimBtn" id="continue" >Continue</moi:PushButton></td>
				</tr>
			</table>
		</div>
	</body>
</html>



code:
// _TestZoomArea.js
function DoZoomArea()

{
    var dlg = moi.ui.commandDialog;
	
	while ( 1 )
	{
		// Wait for user input
		
		if ( !dlg.waitForEvent() ) // if waitForEvent returns false the command is being canceled.
			return false;
			
		if ( dlg.event == 'quit' ) // User Quit
			break;
	}

	if ( moi.ui.commandDialog.event == 'cancel' ) {  // User Canceled
            moi.ui.commandUI.cancel(); 
            return;
        }
 }

DoZoomArea();