Try this. You will need a form with a gadget and a label.

-Sugho-


void ShowProgress(FormPtr *io_pFrm, CharPtr i_sLabel, Boolean i_bShow)
{
        RectangleType uRect;

        if (i_bShow)
        {
                FormPtr pFrm = NULL;
                CharPtr sLabel = NULL;
                pFrm = FrmInitForm(ProgressForm);
                sLabel = FrmGetLabel(pFrm, ProgressWaitLabel);
                //make sure we don't overshoot the label string
                if (StrLen(i_sLabel) > StrLen(sLabel))
                        *sLabel = '\0';
                else
                        FrmCopyLabel(pFrm, ProgressWaitLabel,      i_sLabel);
                FrmDrawForm(pFrm);
                FrmGetObjectBounds(pFrm,
                        FrmGetObjectIndex(pFrm, ProgressProgressGadget), &uRect);
                WinDrawRectangleFrame(rectangleFrame, &uRect);
                *io_pFrm = pFrm;
        }

        else
        {
                FrmEraseForm(*io_pFrm);
                FrmDeleteForm(*io_pFrm);
                *io_pFrm = NULL;
        }

}

//requires FplInit to be called before calling it
void UpdateProgress(FormPtr i_pFrm, Int i_nPercent)
{

        FloatType               fExtent;
        RectangleType           uRect;
        FormPtr                 pFrm = FrmGetActiveForm();

        if (FrmGetFormId(i_pFrm) != ProgressForm)
                return;

        FrmSetActiveForm(i_pFrm);
        FrmGetObjectBounds(i_pFrm,
                        FrmGetObjectIndex(i_pFrm, ProgressProgressGadget), &uRect);
        fExtent = FplLongToFloat((Long) uRect.extent.x);
        fExtent = FplDiv(fExtent, FplLongToFloat(100L));
        fExtent = FplMul(fExtent, FplLongToFloat(i_nPercent));
        uRect.extent.x = (Int) FplFloatToLong(fExtent);
        WinDrawRectangle(&uRect, 0);
        FrmSetActiveForm(pFrm);
}


>From: "David Kendall" <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: "Palm Developers Forum List" <[EMAIL PROTECTED]>
>Subject: Progress indicator?
>Date: Wed, 5 Jan 2000 14:19:57 -0400
>
>Has anyone seen an example of a half-decent progress indicator for the 
>Palm?
>I need to do a quick & dirty utility to upgrade some databases, and a
>progress bar (a la FlashPro) would be nice.
>
>I'd even trade a free Ultrasoft Money registration for the code!
>
>Thx
>
>David Kendall
>Ultra Software Systems, Ltd.
>http://www.ultrasoft.com
>
>

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

Reply via email to