delphi4arab منتديات دلفي للعرب
تغيير عنوان الفورم - نسخة قابلة للطباعة

+- delphi4arab منتديات دلفي للعرب (https://delphi4arab.net/forum)
+-- قسم : منتديات دلفي للعرب التعليمية (https://delphi4arab.net/forum/forumdisplay.php?fid=3)
+--- قسم : سؤال و جواب حول دلفي (https://delphi4arab.net/forum/forumdisplay.php?fid=15)
+--- الموضوع : تغيير عنوان الفورم (/showthread.php?tid=6441)



تغيير عنوان الفورم - rabihpascal - 14-09-2014

السلام عليكم كيف اجعل عنوان الفورم يتبدل كآخر كلمة اكتبها في الميمو او richedit او آخر كلمتين لو امكن


تغيير عنوان الفورم - Agmcz - 14-09-2014

في الحدث OnChange لـ Memo أو RichEdit
ضع شي مثل

PHP كود :
var
  
SL: TStringList;
begin
  SL 
:= TStringList.Create;
  try
    
SL.Delimiter := ' ';
    
SL.DelimitedText := Memo1.Text; // or SL.DelimitedText := RichEdit1.Text;
    
if SL.Count > 0 then
      Caption 
:= SL[Pred(SL.Count)];
  finally
    
SL.Free;
  
end;
end; 



تغيير عنوان الفورم - S.FATEH - 15-09-2014

السلام عليكم
طريقة اخرى اخر كلمتين اتركها لك :confused:
PHP كود :
function TForm1.LastWord(Value: String): String;
begin
// get the last line
  
Value := Copy(Value, LastDelimiter(#13#10, Value), Length(Value));
// get the last word
  
Result := Trim(copy(Value, LastDelimiter(' ',Value), Length(Value)));
end;

procedure TForm1.Memo1Change(Sender: TObject);
begin
  
if not (LastWord(Memo1.Text) = EmptyStr) then
    Caption 
:= LastWord(Memo1.Text);
end;