Board index » cppbuilder » sending the output of a Timer control to a edit box control

sending the output of a Timer control to a edit box control

Hi,

I'm writing a pedagogical program to compare binary vs. linear searches
and I'm trying to use a timer control.  Enabling and disabling the timer
is no problem.  The problem I am having is in sending the timer value to
a edit box control.  The code for the linear search is given below.  )A
search value is entered and an array (external to the search function is
searched for the value.  The search works fine.  The problem is just in
how I'm handling the timer).  I have searched the available newsgroup
posts for a similar problem and have found none at this time.

void __fastcall TForm1::LinearClick(TObject *Sender)
{
    Timer1->Enabled=true;
    int SearchNum = StrToInt(SearchNumber->Text);

    for (int i = 0; i < sizea; i++)
    {
        if (SearchNum == a[i])
        {
            ArrayOut->Text = "Number found at position " + IntToStr(i);
            break;
        }
    Timer1->Enabled=false;
    TimeOut->Text = IntToString(Timer1);                 //
<<<<<<<<<<<<< error occures here
    ArrayOut->Text = "Search Number is not in the array";
    }

Quote
}

Any help would be greatly appreciated.
Steven
 

Re:sending the output of a Timer control to a edit box control


Quote
On Sat, 06 Apr 2002 13:00:43 -0500, sd <sda...@yahoo.com> wrote:
>I'm writing a pedagogical program to compare binary vs. linear searches
>and I'm trying to use a timer control.  Enabling and disabling the timer
>is no problem.  The problem I am having is in sending the timer value to
>a edit box control.  The code for the linear search is given below.  )A
>search value is entered and an array (external to the search function is
>searched for the value.  The search works fine.  The problem is just in
>how I'm handling the timer).  I have searched the available newsgroup
>posts for a similar problem and have found none at this time.

A TTimer doesn't have a "value" - its purpose is to trigger an event
after a preset interval. To /measure/ a time interval, call
GetTickCount(), which is a free-running millisecond counter i.e. call
it, store its result, run your code, call it again and subtract the
first value.

Other Threads