FindReplaceDialog



  • Hallo an Alle,
    ich habe ein Problem, beim Suchen von Gross-bzw. Kleingeschriebenen Wörtern in einem Dokument.
    Meine Suche unterscheidet eben nicht zw. Gross und Kleinschreibung!
    Was mache ich falsch?
    Ich habe nun auch die Fehlermeldungen kopiert, aber darum geht es mir nicht, denn das ist hauptsächlich ein Variablenproblem, welches leicht zu beheben ist.

    /*                  Suchen von Text in einem Richtextfeld                  */
    /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
    
    WBool Form1::Suchen_Ersetzen_Dialog_1_FindReplace(
        WObject *                   source,
        WFindReplaceEventData *     event )
    {
    
        WRange           editSelectionRange; //den ausgewählt.Bereich editieren
        WLong            stringLength;//stringLength
        WString          suchtext;    //findText
    
        WLong          position, letztePos;
          WLong          charIndex; //charIndex
          WLong          startIndex; //wo soll angefangen werden??
    
        WBool            ganzwort;
        WBool            gross;
    
        ganzwort = event->wholeWord;
        gross = event->matchCase; 
    
    //get the user supplied FindText
    suchtext = Suchen_Ersetzen_Dialog_1->GetFindText();
    
    //get the current selection range(Bereich)highlighted text
    //editSelectionRange = Suchen_Ersetzen_Dialog_1->GetEditSelection();
    
    //determine if there is a current selection
    Syntax error.
    if(editSelectionRange.end - editSelectionRange.start)==0)
    {
        startIndex = 0;
    }
    else
    {
        startIndex = rtb_1->GetCaretPosition();
    }
    Declaration statement follows an if statement.
    return FALSE;
    No reference to symbol 'stringLength'.
    'long stringLength' in 'bool stdcall Form1::Suchen_Ersetzen_Dialog_1_FindReplace( WObject *, WFindReplaceEventData * )' defined in: C:\CWI\Renate_2\Release\Form1.cpp(578) (col 22).
    No reference to symbol 'position'.
    'long position' in 'bool stdcall Form1::Suchen_Ersetzen_Dialog_1_FindReplace( WObject *, WFindReplaceEventData * )' defined in: C:\CWI\Renate_2\Release\Form1.cpp(582) (col 20).
    No reference to symbol 'letztePos'.
    'long letztePos' in 'bool stdcall Form1::Suchen_Ersetzen_Dialog_1_FindReplace( WObject *, WFindReplaceEventData * )' defined in: C:\CWI\Renate_2\Release\Form1.cpp(582) (col 30).
    No reference to symbol 'charIndex'.
    'long charIndex' in 'bool stdcall Form1::Suchen_Ersetzen_Dialog_1_FindReplace( WObject *, WFindReplaceEventData * )' defined in: C:\CWI\Renate_2\Release\Form1.cpp(583) (col 22).
    No reference to symbol 'startIndex'.
    'long startIndex' in 'bool stdcall Form1::Suchen_Ersetzen_Dialog_1_FindReplace( WObject *, WFindReplaceEventData * )' defined in: C:\CWI\Renate_2\Release\Form1.cpp(584) (col 22).
    }
    Syntax error.
    }
    }
    else
    {
        startIndex = editSelectionRange.start + 1;
    }
    //find the text in the rich text box
    charIndex = rtb_1->FindText(findText, event->matchCase, event->wholeWord, startIndex, -1);
    //check if the FindText was found
    Syntax error.
    if(charIndex == -1)
    {
        //no text was found so reset the startIndex
        startIndex = -1;
        //close the findDialog
        frepdlg_1->Abort();
    }
    else
    {
        //get the length of the supplied text
        stringLength = findText.GetAnsiLength();
    
        //recalculate the new selection range(highlighted text)
        editSelectionRange = WRange(charIndex, (charIndex + stringLength)),
        //reset the selection range
        rtb_1->SetEditSelection(editSelectionRange);
    }
    //set the start index so the next match can be found
    startIndex = charIndex + 1;
    Syntax error.
    }
    
    /*------------------------ Suchen einer Zeichenkette ---------------------*/
        if (event->findNext)
        {
          suchtext = Suchen_Ersetzen_Dialog_1->GetFindText();
          if (event->searchDown)
          {
            position = Richtextfeld_1->FindText( suchtext, ganzwort, gross, FALSE, beginAt );
            if (position < 0)
            {
              position = Richtextfeld_1->FindText(suchtext);
            }
            text_laenge = suchtext.GetLength();
            zeichen_index.start = position;
            zeichen_index.end = position + text_laenge;
            beginAt =  zeichen_index.end;
    
            Richtextfeld_1->SetFocus( );
            Richtextfeld_1->SetEditSelection( zeichen_index );
          }
          else
          {
              beginAt = beginAt - suchtext.GetLength();
              position = Richtextfeld_1->FindText(suchtext, ganzwort, gross, FALSE, beginAt);
              letztePos = position;
              while(position >= 0)
              {
                  letztePos = position;
                  position = position + suchtext.GetLength();
              }
          }
        }
        return FALSE;
    Syntax error.
    }
    


  • Also in meiner Hilfe zum BCB5 hat die TRichEdit::FindText-Funktion etwas andere Parameter:

    FoundAt = RichEdit1->FindText(FindDialog1->FindText, StartPos, ToEnd,
                                  TSearchTypes()<< stMatchCase);
    

    Demnächst solltest du aber den Fehlercode extra posten (nicht im Quellcode)...

    P.S. dies gehört auch ins BCB-Forum...



  • Hallo

    nein das ist kein Quelltext mit VCL-Typen.

    bis bald
    akari



  • hi

    power++ gehört wohl in rund um, o.ä.

    @renate
    vielleicht mal hier schauen ganz unten und adaptieren
    http://www.c-plus-plus-archiv.de/forum/show.ca/message/9823/

    zu power++ findet sich nicht viel im web, nutzen wohl sehr wenige diese alte ide.



  • Dieser Thread wurde von Moderator/in HumeSikkins aus dem Forum C++ in das Forum Compiler-Forum verschoben.

    Im Zweifelsfall bitte auch folgende Hinweise beachten:
    C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?

    Dieses Posting wurde automatisch erzeugt.


Anmelden zum Antworten