Fonction Lenght en C++ Builder

Bonjour,
je ne sais pas comment utiliser la fonction lenght
si vous pourriez m'aider ça serait gentil.
Configuration: Windows XP
Internet Explorer 7.0

3 réponses

  • Votes
  • Date
  • Date décroissante
  1. Je n'y arrive pas... Je n'ai pas un bon niveau.
    Enfaite je dois faire un programme pour l'école.
    j'ai deux boutons, un pr allé a droite et un pr allé a gauche
    un Edit Box avec ecri "Bonjour" dedans et un autre edit box pour noter le caractète.
    avec les fleches je dois pouvoir passer d'un caractère à un autre.
    1. Cela pourrait donner un truc comme ça avec button1 vers la gauche, button2 vers la droite. Le caractère est sélectionné, à toi d'en faire ce que tu veux : par exemple copie dans un label : Label1->Caption = Edit1->SelText;

      TForm1 *Form1;
      int p;
      //---------------------------------------------------------------------------
      __fastcall TForm1::TForm1(TComponent* Owner)
              : TForm(Owner)
      {
        p = 0;
      }
      //---------------------------------------------------------------------------
      
      void __fastcall TForm1::Button1Click(TObject *Sender)
      {
        p--;
        if (p<0) p=0;
        Edit1->SetFocus();
        Edit1->SelStart = p;
        Edit1->SelLength = 1;
      }
      //---------------------------------------------------------------------------
      
      void __fastcall TForm1::Button2Click(TObject *Sender)
      {
        p++;
        if (p>Edit1->Text.Length()) p=Edit1->Text.Length()-1;
        Edit1->SetFocus();
        Edit1->SelStart = p;
        Edit1->SelLength = 1;
      }
      //---------------------------------------------------------------------------