CherSoft Ltd www.chersoft.co.uk Home   About   Advantages   Developer Reference   Downloads   FAQ   Contact

Idle Time

By Andrew Nibbs

Tuesday, January 04, 2005
ENCX can perform image caching in idle time to improve performance. This article explains how.

By preparing and caching 'tiles' of chart in idle time ENCX can provide faster response to a user scrolling a chart. To make use of this application developers have to call a method on the ENCX Library object in response to idle messages.

How important is it?

Probably not very!

The library will work without any idle time, however, when scrolling around charts performance will be better if the library is given some idle time.

On a modern desktop PC you are unlikely to notice much difference but computers used at sea might of lower specification to developer workstations.

Currently only the raster display side of ENCX uses idle time.

How is it done?

To allow the ENCX library some idle time you must call DoIdle() on your library object.

In an MFC application you could this in an override of CWinApp::OnIdle(..).

DoIdle() returns true if any more idle time is needed - matching the behaviour of CWinApp.

virtual BOOL OnIdle(LONG lCount)

Example

class CMyApp : public CWinApp
{
    ...

    virtual BOOL OnIdle(LONG lCount);

    ...
};


BOOL CMyApp::OnIdle(LONG lCount)
{
    if (CWinApp::OnIdle(lCount))
    {
        return true;
    }

    if (m_pEncX)
    {
        return m_pEncX->DoIdle();
    }

    return false;
}

Andrew Nibbs has developed software and managed projects for Chersoft for ten years. He specialises in C++ and does a bit of C#. He once wrote a Python script.

ENCX Home