At 09:13 AM 4/13/2005, you wrote:
On the Treo 600 SMS application, when you send a message, a little box appears with the text "Sending Message". Does anyone know how they are doing that? Is that a little form that is displayed? Is it some control?

Is there a code sample somewhere?

If you use the POL library, there's a class called CWaitForm that lets you show a form for a limited length of time, and a class called CWaitFrame that does a small message centered on the screen. That was based on code I originally wrote for my SXSW app... if you want to translate this from C++ to plain C, feel free, although the code in POL has better error checking and is more flexible.


CMessageFrame::CMessageFrame(
    CString line1, CString line2, UInt16 yOffset) :
    m_savedBits(0)
{
    CRect rect;

    Int16 line1Width = FntCharsWidth(line1, line1.GetLength());
    Int16 line2Width = FntCharsWidth(line2, line2.GetLength());

    rect.extent.x = pol_max(line1Width, line2Width) + 10;
    rect.extent.y = 2 * FntCharHeight() + 6;
    rect.topLeft.x = (160 - rect.extent.x) / 2;
    rect.topLeft.y = (160 - yOffset - rect.extent.y) / 2 + yOffset;

    CPoint line1Origin(
        rect.topLeft.x + (rect.extent.x - line1Width) / 2,
        rect.topLeft.y + 3);
    CPoint line2Origin(
        rect.topLeft.x + (rect.extent.x - line2Width) / 2,
        rect.topLeft.y + FntCharHeight() + 3);

    WinGetFramesRectangle(dialogFrame, &rect, &m_savedBitsRect);

    UInt16 error;
    m_savedBits = WinSaveBits(&m_savedBitsRect, &error);

    WinEraseRectangle(&rect, 0);
    WinDrawRectangleFrame(dialogFrame, &rect);

    WinDrawChars(line1, line1.GetLength(), line1Origin.x, line1Origin.y);
    WinDrawChars(line2, line2.GetLength(), line2Origin.x, line2Origin.y);
}

CMessageFrame::~CMessageFrame()
{
    if (m_savedBits)
    {
        WinRestoreBits(
            m_savedBits,
            m_savedBitsRect.topLeft.x,
            m_savedBitsRect.topLeft.y);
    }
}



-- Ben Combee, Senior Software Engineer, palmOne, Inc.
   "Combee on Palm OS" weblog: http://palmos.combee.net/
   Developer Forum Archives:   http://news.palmos.com/read/all_forums/


-- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/

Reply via email to