Board index » cppbuilder » How to get a fuction working ONLY for a specific selection, NOT entire RichEdit->Text
Oren (Halvani.de)
![]() CBuilder Developer |
How to get a fuction working ONLY for a specific selection, NOT entire RichEdit->Text2003-08-14 05:41:43 AM cppbuilder31 hi dear builders, one more question.. how can I change some functions that are doing some textmanipulation work on a entire RichEdit1->Text ONLY to work for a specific selection ??? So NOT for the whole Text in the RichEdit, only for a certain selection... For doing that I want to place a CheckBox, so the user can choose if he wants the function to work for the whole text or only the selection.. if(CheckBox1->Cheked == true) { // Only selection !!! } else { // Whole text... } I know I have to use the SelStart, SelLength...but HOW ?? This is not realy easy because I don't know where the selection starts, how long it is and where the selection ends... Thanks for any help... Oren /*****************************************************/ void __fastcall TfrmStringDetails::cmdSeperate_LettersClick(TObject *Sender) { // buggy function , not work very well :-) !!!!! RichEdit1->Lines->BeginUpdate(); try { int iCount = RichEdit1->Lines->Count; for(int i = 0; i < iCount; ++i) { AnsiString str = RichEdit1->Lines->Strings[i]; AnsiString temp; for(int x = 1; x <= str.Length(); ++x) temp += str[x] + " "; RichEdit1->Lines->Strings[i] = temp; } } __finally {RichEdit1->Lines->EndUpdate();} } |