Had done it before, so until Tomasz gets to it -
//--------------------------------------------------------------------------------------------------
//
// This function checks the current display range, and if it has
changed, it
// synchronizes all other windows (documents) to that range.
//
// To use, #include this file in an indicator in each window
(document) to be
// synchronized. Normally it sync's other windows (documents) when
the caller's
// displayed date range changes, but it has an optional parameter to
force a re-sync.
//
// NOTE - the only downside is that the blank bars on the right side are
// removed by the ZoomToRange method
//
// Bruce R - 12/10/08
//
//--------------------------------------------------------------------------------------------------
function ZoomSync( force )
{
// All variables are made local to guarantee naming collisions or
side effects
local bv, dr, Curstdt, Curenddt, prevstdt, prevenddt,
Curststr,
Curendstr;
local OAB, OAD, dcount, i, OADoc, OAW, OADocWin, res;
// Get a count of the number of documents
OAB = CreateObject( "Broker.Application" );
OAD = OAB.Documents;
dcount = OAD.Count;
// Process multiple windows (documents)
res = False;
if ( dcount > 1 )
{
// Get current and last start and end DateTimes's
bv = Status( "barvisible" );
dt = DateTime( );
Curstdt = LastValue( Lowest( IIf( bv, dt, LastValue( dt
) ) ) );
Curenddt = LastValue( Highest( IIf( bv, dt, 0 )
) );
prevstdt = Nz( StaticVarGet( "_prevstdt" ) );
prevenddt = Nz( StaticVarGet( "_prevenddt" ) );
// Check for a new date/time range
if ( ( Curstdt != prevstdt OR Curenddt != prevenddt ) OR force )
{
// Set the new last values
StaticVarSet( "_prevstdt", Curstdt );
StaticVarSet( "_prevenddt", Curenddt );
Curststr = DateTimeToStr( Curstdt );
Curendstr = DateTimeToStr( Curenddt );
// Loop through the document collection
for ( i = 0; i < dcount; i++ )
{
// If it is not the active document -
OADoc = OAD.Item( i );
// NOTE - it doesn't hurt to sync the current
window and it makes all
// windows have no blank bars on the
right so they look
the same
//if ( OADoc != OAB.ActiveDocument )
{
// Get the document window and zoom to
range
//_TRACE( " Zoom to range document - "
+ i + " , " + Curststr +
" - " + Curendstr );
OADW = OADoc.Windows;
// Document window count assumed to be
1
OADocWin = OADW.Item( 0
);
OADocWin.ZoomToRange( Curststr,
Curendstr );
}
}
res = True;
}
}
return res;
}
// Call for synchronization
ZoomSync( False );
--- In [email protected], "sidhartha70" <sidharth...@...> wrote:
>
> TJ,
>
> Would 'zoom link' functionality be difficult to implement...?
>