Board index » cppbuilder » How to show a ProgresBar for: RichEdit1->Text.UpperCase() ??
Oren Halvani
![]() CBuilder Developer |
Oren Halvani
![]() CBuilder Developer |
How to show a ProgresBar for: RichEdit1->Text.UpperCase() ??2004-05-11 12:17:03 AM cppbuilder114 hi dear builders, how can i show a ProgresBar for this function ? /**********************************************/ void __fastcall TForm1::cmdUpperClick(TObject *Sender) { RichEdit1->Text = RichEdit1->Text.UpperCase(); } /**********************************************/ i don't have a line that i can access, so i cannot set: ProgressBar->Max = RichEdit1->Lines->Count; is there another solution...? thanks in advance... Oren |
Remy Lebeau (TeamB)
![]() CBuilder Developer |
2004-05-11 01:17:32 AM
Re:How to show a ProgresBar for: RichEdit1->Text.UpperCase() ??
"Oren Halvani" < XXXX@XXXXX.COM >wrote in message
Quotehow can i show a ProgresBar for this function ? #include <ctype.h> void __fastcall TForm1::cmdUpperClick(TObject *Sender) { AnsiString s = RichEdit1->Text; char *ptr = s.c_str(); ProgressBar1->Position = 0; ProgressBar1->Max = s.Length(); ProgressBar1->StepBy = 1; for(int x = 1; x <= s.Length(); ++x) { *(ptr++) = static_cast<char>(toupper(s[x])); ProgressBar1->StepIt(); ProgressBar1->Update(); } RichEdit1->Text = s; } Quotei don't have a line that i can access, so i cannot set: void __fastcall TForm1::cmdUpperClick(TObject *Sender) { int count = RichEdit1->Lines->Count; ProgressBar1->Position = 0; ProgressBar1->Max = count; ProgressBar1->StepBy = 1; RichEdit1->Lines->BeginUpdate(); try { for(int x = 0; x < count; ++x) { RichEdit1->Lines->Strings[x] = RichEdit1->Lines->Strings[x].UpperCase(); ProgressBar1->StepIt(); ProgressBar1->Update(); } } __finally { RichEdit1->Lines->EndUpdate(); } } Gambit |
Oren Halvani
![]() CBuilder Developer |
2004-05-11 06:42:36 AM
Re:How to show a ProgresBar for: RichEdit1->Text.UpperCase() ??
hi Remy, i've took your second sample:
Quotevoid __fastcall TForm1::cmdUpperClick(TObject *Sender) Memo1->Text = Memo1->Text.UpperCase(); i guess it's get slow because you go line by line.. and my code take to whole text and makes it uppercase at once.. hmm...is there maybe a possibility to optimize your function..? Oren {smallsort} |
Remy Lebeau (TeamB)
![]() CBuilder Developer |
2004-05-11 07:10:08 AM
Re:How to show a ProgresBar for: RichEdit1->Text.UpperCase() ??
"Oren Halvani" < XXXX@XXXXX.COM >wrote in message
Quotebut i just wonder, WHY IS IT WORKS SOOOO SLOW ?? Why do you want a progress bar on this anyway? Chances are, when you let the code run without a progress bar at all, you will be able to convert large amounts of text very fast so that the user wouldn't even see a change in the progress bar to begin with. Gambit |
Oren Halvani
![]() CBuilder Developer |
2004-05-11 07:36:37 AM
Re:How to show a ProgresBar for: RichEdit1->Text.UpperCase() ??
"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >schrieb im
Newsbeitrag news:40a00d18$ XXXX@XXXXX.COM ... Quote
the thing is our customer wants for every operation of the programm a ProgressBar that shows where the programm is exactly at the moment.. i guess there is no optimizing solution for my problem, right :-) ?? Oren |
Remy Lebeau (TeamB)
![]() CBuilder Developer |
2004-05-11 08:36:18 AM
Re:How to show a ProgresBar for: RichEdit1->Text.UpperCase() ??
"Oren Halvani" < XXXX@XXXXX.COM >wrote in message
Quotewell, it's true...OK you have to wait about 7 code has to be causing the delays Gambit |