delphi4arab منتديات دلفي للعرب
مشكله اضافه الادوات داخل function - نسخة قابلة للطباعة

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



مشكله اضافه الادوات داخل function - عبد الله اكرم - 14-02-2019

 

السلام عليكم 
 
اخواني لدي مشكله اضافه الادوات داخل 
function
وهذه صوره توضح المشكله

[صورة: p_114090ruk1.png]

وشكراا لكم احبتي



RE: مشكله اضافه الادوات داخل function - Rever7eR - 14-02-2019

(14-02-2019, 07:39 PM)عبد الله اكرم كتب :
السلام عليكم 
 

و عليكم السلام و رحمة الله تعالى و بركاته
لا يمكن استعمال المكونات داخل ال Functions
اظن انك تقصد هذا :

كود :
Function MaxValue(a,b : Integer):Integer; begin    if a > b then    result := a    else    result := b; end; procedure TForm1.Button1Click(Sender: TObject); begin edit1.text := 'Hello'  + ' ' + IntToStr(MaxValue(7,11));  // call function end; end.



RE: مشكله اضافه الادوات داخل function - merouane - 14-02-2019

وعليكم السلام


إما أن تضيف الإجراء ضمن class الخاص بالفورم أو تقوم بالاستدعاء عبر كامل الطرف الأبوي

PHP كود :
type
  TForm1 
= class(TForm)
  
   
private
    { Private declarations }

  public
    { Public declarations }
    function MaxValue(a, b: integer): integer;
  end;
  
  
function TForm1.MaxValue(a, b: integer): integer;
begin
    if a 
> b then
        result 
:= a
    else
        result 
:= b;
    Edit1.text := 'Hello';
end; 



أو

PHP كود :
function MaxValue(a, b: integer): integer;
begin
    if a 
> b then
        result 
:= a
    else
        result 
:= b;
    Form1.Edit1.text := 'Hello';
end; 



RE: مشكله اضافه الادوات داخل function - عبد الله اكرم - 14-02-2019

(14-02-2019, 08:19 PM)merouane كتب : وعليكم السلام


إما أن تضيف الإجراء ضمن class الخاص بالفورم أو تقوم بالاستدعاء عبر كامل الطرف الأبوي

PHP كود :
type
  TForm1 
= class(TForm)
  
   
private
    { Private declarations }

  public
    { Public declarations }
    function MaxValue(a, b: integer): integer;
  end;
  
  
function TForm1.MaxValue(a, b: integer): integer;
begin
    if a 
> b then
        result 
:= a
    else
        result 
:= b;
    Edit1.text := 'Hello';
end; 



أو

PHP كود :
function MaxValue(a, b: integer): integer;
begin
    if a 
> b then
        result 
:= a
    else
        result 
:= b;
    Form1.Edit1.text := 'Hello';
end; 

شكرااا اخي هذا هوه المطلوب Smile