17-08-2019, 05:12 PM
(17-08-2019, 04:59 PM)samnaj00 كتب :جزاك الله خيرا(15-08-2019, 02:52 PM)بوزيان كتب : ما طريقة جعل المؤشر في edit عند تنفيد أمر البحث في هذا المثال المرفق أي لا ينتقل إلى richedit، مع إبقاء الأمر في Edit1Changeاخي الكريم
[size=small]المثال المرفق[/size]
فقط احذف من هذا الكود هذه الكلمة setfocus
كود :procedure RE_ColorerMots(RE: TRichEdit; Mot: ShortString; AColor: TColor; var Count: integer); // 3 secondes 37 secondes 721 ms pour 4784 mots dans Zola992K.txt de 992 Ko label Recomm; var FoundAt: LongInt; StartPos, ToEnd: Integer; begin Count := 0; with RE do begin // Commence la recherche après la sélection en cours s'il y en a une sinon, commence au début du texte if SelLength <> 0 then StartPos := SelStart + SelLength else StartPos := 0; Recomm: ToEnd := Length(Text) - StartPos; // ToEnd indique la longueur entre StartPos et la fin du texte du RichEdit FoundAt := FindText(Mot, StartPos, ToEnd, [stMatchCase]); if FoundAt <> -1 then begin inc(Count); فقط احذف هذه الكلمة setfocus SetFocus; SelStart := FoundAt; SelLength := Length(Mot); SelAttributes.Color := AColor; StartPos := FoundAt + Length(Mot); if StartPos < length(Text) then goto Recomm; end; SelLength := 0; end; end;

