مهم : پروسیجر دلفی

smad+

عضو جدید
سلام. کسی میدونه پروسیجر رو تو دلفی کجا و چه جوری باید تعریف کنیم؟
خواهشا سریع جواب بدید
ممنون
 

smad+

عضو جدید
به قرآن من یه کار واجب دارم. لطفا هرکی میدونه لطف کنه بگه
 

minair2004

عضو جدید
در قسمت implementation یا public و... بستگی به نیاز.مثلا در قسمت public بزاری در فرم های دیگه هم می تونی ازش استفاده کنی
 

smad+

عضو جدید
ممنون ميشه مثال براي تفريف و استفاده از آن بزنيد؟
لطفا دقيق تر و با حوصله تر جواب بديد جسارتا
 

SHRP

همکار مدیر تالار مهندسی کامپیوتر متخصص برنامه نوی
کاربر ممتاز
ممنون ميشه مثال براي تفريف و استفاده از آن بزنيد؟
لطفا دقيق تر و با حوصله تر جواب بديد جسارتا
درسته دير شده ولي شايد بكار ديگران بياد:
کد:
[B]/ Full Unit code.[/B]
[COLOR=#008000][FONT=Courier New][B]// -----------------------------------------------------------[/B]
[/FONT][/COLOR][COLOR=#008000][FONT=Courier New][B]// You must store this code in a unit called Unit1 with a form[/B]
[/FONT][/COLOR][COLOR=#008000][FONT=Courier New][B]// called Form1 that has an OnCreate event called FormCreate.[/B]
[/FONT][/COLOR][FONT=Courier New][SIZE=2][COLOR=#000000]
[/COLOR][/SIZE][/FONT]
[B][COLOR=#000000][FONT=Courier New][B]unit Unit1;[/B][/FONT][/COLOR]
[FONT=Courier New][SIZE=2][COLOR=#000000]
[/COLOR][/SIZE][/FONT]
[B][COLOR=#000000][FONT=Courier New][B][B]interface[/B][/B][/FONT][/COLOR]
[FONT=Courier New][SIZE=2][COLOR=#000000]
[/COLOR][/SIZE][/FONT]
[B][COLOR=#000000][FONT=Courier New][B][B][B]uses[/B][/B][/B][/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New][B][B][B]  [COLOR=#008000][B]// The System unit does not need to be defined[/B][/COLOR][/B][/B][/B][/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New][B][B][B]  Forms, Dialogs;[/B][/B][/B][/FONT][/COLOR]
[FONT=Courier New][SIZE=2][COLOR=#000000]
[/COLOR][/SIZE][/FONT]
[B][COLOR=#000000][FONT=Courier New][B][B][B][B]type[/B][/B][/B][/B][/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New][B][B][B][B]  TForm1 = class(TForm)[/B][/B][/B][/B][/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New][B][B][B][B]    procedure FormCreate(Sender: TObject);[/B][/B][/B][/B][/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New][B][B][B][B]  end;[/B][/B][/B][/B][/FONT][/COLOR]
[FONT=Courier New][SIZE=2][COLOR=#000000]
[/COLOR][/SIZE][/FONT]
[B][COLOR=#000000][FONT=Courier New][B][B][B][B][B]var[/B][/B][/B][/B][/B][/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New][B][B][B][B][B]  Form1: TForm1;[/B][/B][/B][/B][/B][/FONT][/COLOR]
[FONT=Courier New][SIZE=2][COLOR=#000000]
[/COLOR][/SIZE][/FONT]
[B][COLOR=#000000][FONT=Courier New][B][B][B][B][B][B]implementation[/B][/B][/B][/B][/B][/B][/FONT][/COLOR]
[B][COLOR=#000000][FONT=Courier New][B][B][B][B][B][B][B]{$R *.dfm} // Include form definitions[/B][/B][/B][/B][/B][/B][/B][/FONT][/COLOR]
[FONT=Courier New][SIZE=2][COLOR=#000000]
[/COLOR][/SIZE][/FONT]
[B][COLOR=#000000][FONT=Courier New][B][B][B][B][B][B][B][B][COLOR=#C00000][B]Procedure[/B][/COLOR] ShowSum(a, b : Integer);[/B][/B][/B][/B][/B][/B][/B][/B][/FONT][/COLOR]
[B][COLOR=#000000][FONT=Courier New][B][B][B][B][B][B][B][B][B]var[/B][/B][/B][/B][/B][/B][/B][/B][/B][/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New][B][B][B][B][B][B][B][B][B]  total : Integer;[/B][/B][/B][/B][/B][/B][/B][/B][/B][/FONT][/COLOR]
[B][COLOR=#000000][FONT=Courier New][B][B][B][B][B][B][B][B][B][B]begin[/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New][B][B][B][B][B][B][B][B][B][B]  [COLOR=#008000][B]// Add the two numbers together[/B][/COLOR][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New][B][B][B][B][B][B][B][B][B][B]  total := a + b;[/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/FONT][/COLOR]
[B][FONT=Courier New][SIZE=2][COLOR=#000000]
[/COLOR][/SIZE][/FONT]
[FONT=Courier New][SIZE=2][COLOR=#000000][B][B][B][B][B][B][B][B][B][B][B][FONT=Courier New][SIZE=2][COLOR=#000000]  [/COLOR][/SIZE][/FONT][COLOR=#000000][FONT=Courier New][B]// And display the sum[/B][/FONT][/COLOR][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B]
[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#000000][B][B][B][B][B][B][B][B][B][B][B][FONT=Courier New][SIZE=2][COLOR=#000000]  ShowMessageFmt('%d + %d = %d',[a,b,total]);[/COLOR][/SIZE][/FONT][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B]
[/COLOR][/SIZE][/FONT][B][COLOR=#000000][FONT=Courier New][B][B][B][B][B][B][B][B][B][B][B][B]end;[/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/FONT][/COLOR]
[B][FONT=Courier New][SIZE=2][COLOR=#000000]
[/COLOR][/SIZE][/FONT]
[COLOR=#008000][COLOR=#000000][FONT=Courier New][B][B][B][B][B][B][B][B][B][B][B][B][B][COLOR=#000000][FONT=Courier New][B]// The main form On Create routine - our main program[/B][/FONT][/COLOR][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B]
[/FONT][/COLOR][/COLOR][B][B][B][B][B][B][B][B][B][B][B][B][B][B][B]procedure TForm1.FormCreate(Sender: TObject);[/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B]
[B][B][B][B][B][B][B][B][B][B][B][B][B][B][B][B]begin[/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B]
[B][B][B][B][B][B][B][B][B][B][B][B][B][B][B]  [COLOR=#008000][B]// Show the sum of a few number pairs[/B][/COLOR][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B]
[B][B][B][B][B][B][B][B][B][B][B][B][B][B][B]  ShowSum(1,2);[/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B]
[B][B][B][B][B][B][B][B][B][B][B][B][B][B][B]  ShowSum(245,62);[/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B]
[B][B][B][B][B][B][B][B][B][B][B][B][B][B][B][B][B]end;[/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B]
[/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B][/B]
 

Similar threads

بالا