Bonjour,

J'ai fait un projet dans lequel l'utilisateur peut entrer du texte dans un TEdit puis après il peut naviger avec des boutons en avant et en arrière. Au fait je voudrais bloquer la navigation au nombre de caracteres que l'utilisateur a rentrer.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
 
//-------------------------------------------------------------------------
#include <vcl.h>
#include <stdio.h>
#pragma hdrstop
 
#include "ufmMain.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TfmMain *fmMain;
 
char cMonTexte[100] = "" ;
int iIndice = 0 ;
AnsiString asMonTexte = "" ;
 
//---------------------------------------------------------------------------
__fastcall TfmMain::TfmMain(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TfmMain::buSuivantClick(TObject *Sender)
{
asMonTexte = edSaisie->Text;
sprintf(cMonTexte,"%s",asMonTexte);
iIndice = iIndice + 1 ;
edIndice->Text = iIndice ;
edCaractere->Text = cMonTexte[iIndice];
}
//---------------------------------------------------------------------------
 
void __fastcall TfmMain::FormCreate(TObject *Sender)
{
edIndice->Text = iIndice ;
edCaractere->Text = cMonTexte[iIndice];
}
//---------------------------------------------------------------------------
 
void __fastcall TfmMain::buPrecedentClick(TObject *Sender)
{
asMonTexte = edSaisie->Text;
sprintf(cMonTexte,"%s",asMonTexte);
iIndice = iIndice - 1 ;
edIndice->Text = iIndice ;
edCaractere->Text = cMonTexte[iIndice];
 
}
//-------------------------------------------------------------------------