Sayfayı Yazdır | Pencereyi Kapat

Bu koddaki işlem getirme kısmını sadece procedure

Nereden Yazdırıldığı: Clomosy | Forum
Kategori: Genel Programlama
Forum Adı: Genel İşlemler
Forum Tanımlaması: TRObject dili ile programlama yaparken karşılaşılan genel işlemler
URL: https://forum.clomosy.com.tr/forum_posts.asp?TID=524
Tarih: 06 Ocak 2025 Saat 12:33
Program Versiyonu: Web Wiz Forums 12.07 - https://www.webwizforums.com


Konu: Bu koddaki işlem getirme kısmını sadece procedure
Mesajı Yazan: kader
Konu: Bu koddaki işlem getirme kısmını sadece procedure
Mesaj Tarihi: 28 Temmuz 2023 Saat 09:58
Var   
MyForm:TclForm;
testButton,testButton2 ,testButton3,testButton4,testButton5,testButton6,testButton7,testButton8,testButton9,testButton10,testButton11,testButton12,testButton13,testButton14,testButton15,testButton16,testButton17,testButton18,testButton19,testButton20,testButton21,testButton22,testButton23,testButton24,testButton25,testButton26:TclButton;
a,b:Integer;
editNumber:TclProEdit;
Function getSum(a,b: Integer):Integer;
  begin
     Result := a + b;
  end;
procedure cagir
begin
editNumber.Text:=IntToStr(getSum(a,b));
end; 
begin

MyForm := TclForm.Create(Self);
testButton:= MyForm.AddNewButton(MyForm,'testButton','3');
testButton.TextSettings.Font.Size:=50;
testButton.Align := alCenter;
testButton.Height := 50;
testButton.Width := 100;
testButton.Margins.Left:= 200;
MyForm.AddNewEvent(testButton,tbeOnClick,'editNumber.Text := editNumber.Text + ''3''');

testButton2:= MyForm.AddNewButton(MyForm,'testButton2','2');
testButton2.TextSettings.Font.Size:=50;
testButton2.Align := alCenter;
testButton2.Height := 50;
testButton2.Width := 100;
MyForm.AddNewEvent(testButton2,tbeOnClick,'editNumber.Text := editNumber.Text + ''2''' );



testButton3:= MyForm.AddNewButton(MyForm,'testButton3','1');
testButton3.TextSettings.Font.Size:=50;
testButton3.Align := alCenter;
testButton3.Height := 50;
testButton3.Width := 100;
testButton3.Margins.right:=200 ;
MyForm.AddNewEvent(testButton3,tbeOnClick,'editNumber.Text := editNumber.Text + ''1''' );

testButton4:= MyForm.AddNewButton(MyForm,'testButton4','4');
testButton4.TextSettings.Font.Size:=50;
testButton4.Align := alCenter;
testButton4.Height := 50;
testButton4.Width := 100;
testButton4.Margins.top:=200 ;
testButton4.Margins.right:= 200;
MyForm.AddNewEvent(testButton4,tbeOnClick,'editNumber.Text := editNumber.Text + ''4''' );

testButton5:= MyForm.AddNewButton(MyForm,'testButton5','5');
testButton5.TextSettings.Font.Size:=50;
testButton5.Align := alCenter;
testButton5.Height := 50;
testButton5.Width := 100;
testButton5.Margins.top:=200 ;
MyForm.AddNewEvent(testButton5,tbeOnClick,'editNumber.Text := editNumber.Text + ''5''');
 
testButton6:=MyForm.AddNewButton(MyForm,'testButton6','6');
testButton6.TextSettings.Font.Size:=50;
testButton6.Align := alCenter;
testButton6.Height := 50;
testButton6.Width := 100;
testButton6.Margins.top:=200 ;
testButton6.Margins.left:= 200;
MyForm.AddNewEvent(testButton6,tbeOnClick,'editNumber.Text := editNumber.Text + ''6''' );

testButton7:= MyForm.AddNewButton(MyForm,'testButton7','7');
testButton7.TextSettings.Font.Size:=50;
testButton7.Align := alCenter;
testButton7.Height := 50;
testButton7.Width := 100;
testButton7.Margins.top :=400;
testButton7.Margins.right:=200;
MyForm.AddNewEvent(testButton7,tbeOnClick,'editNumber.Text := editNumber.Text + ''7''' );

testButton8:= MyForm.AddNewButton(MyForm,'testButton8','8');
testButton8.TextSettings.Font.Size:=50;
testButton8.Align := alCenter;
testButton8.Height := 50;
testButton8.Width := 100;
testButton8.Margins.top :=400;
MyForm.AddNewEvent(testButton8,tbeOnClick,'editNumber.Text := editNumber.Text + ''8''' );

testButton9:= MyForm.AddNewButton(MyForm,'testButton9','9');
testButton9.TextSettings.Font.Size:=50;
testButton9.Align := alCenter;
testButton9.Height := 50;
testButton9.Width := 100;
testButton9.Margins.top :=400;
testButton9.Margins.left:=200;
MyForm.AddNewEvent(testButton9,tbeOnClick,'editNumber.Text := editNumber.Text + ''9''' );

testButton10:= MyForm.AddNewButton(MyForm,'testButton10','AC');
testButton10.TextSettings.Font.Size:=50;
testButton10.Align := alCenter;
testButton10.Height := 50;
testButton10.Width := 100;
testButton10.Margins.Bottom:=170;
testButton10.Margins.right :=200;
MyForm.AddNewEvent(testButton10,tbeOnClick,'editNumber.Text := ''''' );

testButton11:= MyForm.AddNewButton(MyForm,'testButton11','%');
testButton11.TextSettings.Font.Size:=50;
testButton11.Align := alCenter;
testButton11.Height := 50;
testButton11.Width := 100;
testButton11.Margins.Bottom:=170;
MyForm.AddNewEvent(testButton11,tbeOnClick,'editNumber.Text := ''%''' );


testButton12:= MyForm.AddNewButton(MyForm,'testButton12','√');
testButton12.TextSettings.Font.Size:=50;
testButton12.Align := alCenter;
testButton12.Height := 50;
testButton12.Width := 100;
testButton12.Margins.Bottom:=170;
testButton12.Margins.left :=200;
MyForm.AddNewEvent(testButton12,tbeOnClick,'editNumber.Text := ''√''' );

testButton13:= MyForm.AddNewButton(MyForm,'testButton13','÷');
testButton13.TextSettings.Font.Size:=50;
testButton13.Align := alCenter;
testButton13.Height := 50;
testButton13.Width := 100;
testButton13.Margins.Bottom:=170;
testButton13.Margins.left :=300;
MyForm.AddNewEvent(testButton13,tbeOnClick,'editNumber.Text := ''÷''' );

testButton14:= MyForm.AddNewButton(MyForm,'testButton14','×');
testButton14.TextSettings.Font.Size:=50;
testButton14.Align := alCenter;
testButton14.Height := 50;
testButton14.Width := 100;
testButton14.Margins.left:=300 ;
MyForm.AddNewEvent(testButton14,tbeOnClick,'editNumber.Text := ''×''');

testButton15:=MyForm.AddNewButton(MyForm,'testButton15','+');
testButton15.TextSettings.Font.Size:=50;
testButton15.Align := alCenter;
testButton15.Height := 50;
testButton15.Width := 100;
testButton15.Margins.top:=200 ;
testButton15.Margins.left:= 300;
MyForm.AddNewEvent(testButton15,tbeOnClick,'editNumber.Text := ''+''' );

testButton16:= MyForm.AddNewButton(MyForm,'testButton16','-');
testButton16.TextSettings.Font.Size:=50;
testButton16.Align := alCenter;
testButton16.Height := 50;
testButton16.Width := 100;
testButton16.Margins.top :=400;
testButton16.Margins.left:=300;
MyForm.AddNewEvent(testButton16,tbeOnClick,'editNumber.Text := ''-''' );

testButton17:= MyForm.AddNewButton(MyForm,'testButton17','0');
testButton17.TextSettings.Font.Size:=50;
testButton17.Align := alCenter;
testButton17.Height := 50;
testButton17.Width := 100;
testButton17.Margins.top :=550;
MyForm.AddNewEvent(testButton17,tbeOnClick,'editNumber.Text := editNumber.Text + ''0''' );

testButton18:= MyForm.AddNewButton(MyForm,'testButton18','•');
testButton18.TextSettings.Font.Size:=50;
testButton18.Align := alCenter;
testButton18.Height := 50;
testButton18.Width := 100;
testButton18.Margins.top :=550;
testButton18.Margins.right:=200;
MyForm.AddNewEvent(testButton18,tbeOnClick,'editNumber.Text := ''•''' );

testButton19:= MyForm.AddNewButton(MyForm,'testButton19','+/-');
testButton19.TextSettings.Font.Size:=50;
testButton19.Align := alCenter;
testButton19.Height := 50;
testButton19.Width := 100;
testButton19.Margins.top :=550;
testButton19.Margins.left:=200;
MyForm.AddNewEvent(testButton19, tbeOnClick,' editNumber.Text:=''+''');

    

testButton20:= MyForm.AddNewButton(MyForm,'testButton20','=');
testButton20.TextSettings.Font.Size:=50;
testButton20.Align := alCenter;
testButton20.Height := 50;
testButton20.Width := 100;
testButton20.Margins.top :=550;
testButton20.Margins.left:=300;
MyForm.AddNewEvent(testButton20,tbeOnClick,'cagir' );
  
testButton21:= MyForm.AddNewButton(MyForm,'testButton21','log');
testButton21.TextSettings.Font.Size:=50;
testButton21.Align := alCenter;
testButton21.Height := 50;
testButton21.Width := 100;
testButton21.Margins.Bottom:=170;
testButton21.Margins.right :=300;
MyForm.AddNewEvent(testButton21,tbeOnClick,'' );

testButton22:= MyForm.AddNewButton(MyForm,'testButton22','sin');
testButton22.TextSettings.Font.Size:=50;
testButton22.Align := alCenter;
testButton22.Height := 50;
testButton22.Width := 100;
testButton22.Margins.right:=300 ;
MyForm.AddNewEvent(testButton22,tbeOnClick,'' );

testButton23:= MyForm.AddNewButton(MyForm,'testButton23','xʸ');
testButton23.TextSettings.Font.Size:=50;
testButton23.Align := alCenter;
testButton23.Height := 50;
testButton23.Width := 100;
testButton23.Margins.top:=200 ;
testButton23.Margins.right:= 300;
MyForm.AddNewEvent(testButton23,tbeOnClick,'' );

testButton24:= MyForm.AddNewButton(MyForm,'testButton24','e');
testButton24.TextSettings.Font.Size:=50;
testButton24.Align := alCenter;
testButton24.Height := 50;
testButton24.Width := 100;
testButton24.Margins.top :=400;
testButton24.Margins.right:=300;
MyForm.AddNewEvent(testButton24,tbeOnClick,'' );

testButton25:= MyForm.AddNewButton(MyForm,'testButton25','π');
testButton25.TextSettings.Font.Size:=50;
testButton25.Align := alCenter;
testButton25.Height := 50;
testButton25.Width := 100;
testButton25.Margins.top :=550;
testButton25.Margins.right:=300;
MyForm.AddNewEvent(testButton25,tbeOnClick,'' );

editNumber := MyForm.AddNewProEdit(MyForm,'editNumber','');
clComponent.SetupComponent(editNumber,'{"Align" : "Center",
"MarginBottom":135,
"MarginTop":-185,
"Width" :180, "Height":100,
"RoundHeight":10,"RoundWidth":10,
"MarginLeft":30}');
MyForm.AddNewEvent(editNumber,tbeOnClick,'cagir' );
MyForm.Run;

end;
Bu koddaki işlem getirme kısmını  sadece procedure ve fonksiyon ile mi yapabiliriz.Başka daha kısa bir kod ile de yapabilir miyiz ?




Sayfayı Yazdır | Pencereyi Kapat

Forum Software by Web Wiz Forums® version 12.07 - https://www.webwizforums.com
Copyright ©2001-2024 Web Wiz Ltd. - https://www.webwiz.net