Comment déterminer la ligne en cours d'un Memo ?
Bonjour à tous
J'ai téléchargé et installé RSSolo4FrenchVirginie depuis:
http://www.mediaforma.com/faire-parl...s-en-francais/
ce code lit parfaitement le contenu entier de Memo1. 8-)
//Uses comobj ;
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| procedure TForm1.GoClick(Sender: TObject);
var
SavedCW: Word;
SpVoice: Variant;
Str:Shortstring ;
I:integer;
begin
SpVoice := CreateOleObject('SAPI.SpVoice');
SavedCW := Get8087CW;
Set8087CW(SavedCW or $4);
For I:=0 to Memo1.Lines.Count-1 Do
begin
Str:=Memo1.Lines.Strings[I] ;
if Trim(Str)<>'' then
SpVoice.Speak(str, 0);
end;
Set8087CW(SavedCW);
end; |
cependant je désire lire ce contenu ligne par ligne, mais j'ai pas su comment récupérer la ligne en cours (sélectionnée) de Memo1?:?
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| procedure TForm1.CetteLigneClick(Sender: TObject);
var
SavedCW: Word;
SpVoice: Variant;
Str:Shortstring ;
begin
SpVoice := CreateOleObject('SAPI.SpVoice');
SavedCW := Get8087CW;
Set8087CW(SavedCW or $4);
Str:=Memo1.Lines. ;// Comment determiner la ligne ou l'index en cours?
if Trim(Str)<>'' then
SpVoice.Speak(str, 0);
Set8087CW(SavedCW);
end; |