[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: synchronised scrolling



PureBytes Links

Trading Reference Links

Hi,

here I am with a slightly different version of the BruceR's function to avoid the undesired zooming when scrolling left at the left edge and to let to show the blank bars on left edge in the main window:

thanks BruceR

Bisto

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
        LastBarIndex = Status( "LastVisibleBarIndex" );
        FirstBarIndex = Status( "FirstVisibleBarIndex" );
        Nblankbar = Status( "LastVisibleBarIndex" ) - BarCount;
        prevLastBarIndex = Nz( StaticVarGet( "_prevLastVisibleBarIndex" ) );
        prevFirstBarIndex = Nz( StaticVarGet( "_prevFirstVisibleBarIndex" ) );
        //  Check for a new date/time range

        if ( ( LastBarIndex != prevLastBarIndex OR FirstBarIndex != prevFirstBarIndex ) OR force )
        {
            //  Set the new last values
            StaticVarSet( "_prevLastVisibleBarIndex", Status( "LastVisibleBarIndex" ) );
            StaticVarSet( "_prevFirstVisibleBarIndex", Status( "FirstVisibleBarIndex" ) );
            DT = DateTime();
            BI = BarIndex();
            LastDateTime =  LastValue( ValueWhen( LastBarIndex  == BI, DT ) );
            FirstDateTime = LastValue( ValueWhen( FirstBarIndex == BI, DT ) );
            LastDateTimestr = DateTimeToStr( LastDateTime );
            FirstDateTimestr = DateTimeToStr( FirstDateTime );
            //  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( FirstDateTimestr, LastDateTimestr  );
                }
            }

            res = True;
        }
    }

    return res;
}


UseZoomer = ParamToggle("Use Zoomer?", "No|Yes", 0);

if (UseZoomer)
    ZoomSync( False );




------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/