Sayfayı Yazdır | Pencereyi Kapat

ödev kodlarda hata

Nereden Yazdırıldığı: Clomosy | Forum
Kategori: Form Oluşturma
Forum Adı: TclForm Oluşturma
Forum Tanımlaması: Standart bir form oluşturma
URL: https://forum.clomosy.com.tr/forum_posts.asp?TID=1515
Tarih: 11 Mayıs 2026 Saat 21:39
Program Versiyonu: Web Wiz Forums 12.07 - https://www.webwizforums.com


Konu: ödev kodlarda hata
Mesajı Yazan: erenertankef
Konu: ödev kodlarda hata
Mesaj Tarihi: 11 Mayıs 2026 Saat 18:31
hocam biz ödev için konuyu belirledik dediğiniz yaptık taslağı hazırladık kodu yazdık düzeltmeye de çalıştık ama buraya kadar geldik yardım edebilir misiniz kodu çalıştırdık hatalı yerleri de bulduk ama düzeltmeye çalıştık olmadı  https://static.cloudflareinsights.com/beacon.min.js/v8c78df7c7c0f484497ecbca7046644da1771523124516" rel="nofollow - https://static.cloudflareinsights.com/beacon.min.js/v8c78df7c7c0f484497ecbca7046644da1771523124516" integrity="sha512-8DS7rgIrAmghBFwoOTujcf6D9rXvH8xm8JQ1Ja01h9QX8EzXldiszufYa4IFfKdLUKTTrnSFXLDkUEOTrZQ8Qg==" data-cf-beacon="{"version":"2024.11.0","token":"439455f3e46c40b98dbd42a2f1a954d8","r":1,"server_timing":{"name":{"cfCacheStatus":true,"cfEdge":true,"cfExtPri":true,"cfL4":true,"cfOrigin":true,"cfSpeedBrain":true},"location_startswith":null}}" crossorigin="anonymous">

var
  MyForm: TClForm;
  beherLayout, scaleLayout, mainArea: TClProLayout;
  beherSivisi, phPointer: TClProShape;
  f1, f2, f3, f4, btnReset: TClProButton;
  txtPH, txtInfo: TClProLabel;
  currentPH: Single;

// pH değerine göre rengi belirleyen fonksiyon
function GetColorByPH(val: Single): string;
begin
  if val < 6.5 then // Asit (Kırmızı tonları)
    Result := '#FF' + IntToHex(Round((val/7)*255), 2) + '00'
  else if val > 7.5 then // Baz (Mavi tonları)
    Result := '00' + IntToHex(Round(((14-val)/7)*255), 2) + 'FF'
  else // Nötr
    Result := '#00FF00';
end;

// UI Güncelleme
procedure UpdateLab;
var
  pos: Integer;
begin
  beherSivisi.FillColor := clAlphaColor.FromHtml(GetColorByPH(currentPH));
 
  // İbreyi hareket ettir (Basit ölçeklendirme)
  pos := Round((currentPH / 14) * (scaleLayout.Width - 30));
  phPointer.Margins.Left := pos;
 
  txtPH.Text := 'pH Değeri: ' + FloatToStrF(currentPH, ffFixed, 1, 1);
end;

// Sıvı Ekleme
procedure AddLiquid(val: Single);
begin
  currentPH := currentPH + val;
  if currentPH > 14 then currentPH := 14;
  if currentPH < 0 then currentPH := 0;
 
  UpdateLab;
  txtInfo.Text := 'Tepkime gözleniyor...';
end;

// Tıklama Olayları
procedure OnF1; begin AddLiquid(-1.5); end; // Asit
procedure OnF2; begin AddLiquid(1.5);  end; // Baz
procedure OnF3; begin AddLiquid(-2.0); end; // Kuvvetli Asit
procedure OnF4; begin AddLiquid(2.0);  end; // Kuvvetli Baz

procedure ResetLab;
begin
  currentPH := 7.0;
  UpdateLab;
  txtInfo.Text := 'Şişelerdeki sıvıları behere ekleyerek test edin.';
end;

begin
  MyForm := TClForm.Create(Self);
  MyForm.SetFormColor('#121212', '', clGNone);
  MyForm.clConfig.BackImage := ' https://img.freepik.com/free-vector/science-lab-interior-background_23-2148482390.jpg" rel="nofollow - https://img.freepik.com/free-vector/science-lab-interior-background_23-2148482390.jpg ';

  // pH Skalası Tasarımı
  scaleLayout := MyForm.AddNewProLayout(MyForm, 'scaleLayout');
  scaleLayout.Align := alTop;
  scaleLayout.Height := 30;
  scaleLayout.Margins.Top := 50;
  scaleLayout.Margins.Left := 40;
  scaleLayout.Margins.Right := 40;
  scaleLayout.clConfig.BorderColor := clAlphaColor.FromHtml('#FFFFFF');
  scaleLayout.clConfig.BorderWidth := 1;
  scaleLayout.clConfig.BackgroundColor := clAlphaColor.FromHtml('#333333');

  phPointer := MyForm.AddNewProShape(scaleLayout, 'phPointer');
  phPointer.Align := alLeft;
  phPointer.Width := 15;
  phPointer.FillColor := clAlphaColor.FromHtml('#FFFFFF');
  phPointer.ShapeType := stCircle;

  txtPH := MyForm.AddNewProLabel(MyForm, 'txtPH', 'pH Değeri: 7.0');
  txtPH.Align := alTop;
  txtPH.Height := 40;
  txtPH.clTextSettings.FontColor := clAlphaColor.FromHtml('#FFFF00');
  txtPH.clTextSettings.HorzAlign := taCenter;

  // Ana Deney Alanı
  mainArea := MyForm.AddNewProLayout(MyForm, 'mainArea');
  mainArea.Align := alClient;
  mainArea.Margins.Top := 20;

  // Beher
  beherLayout := MyForm.AddNewProLayout(mainArea, 'beherLayout');
  beherLayout.Align := alCenter;
  beherLayout.Width := 140;
  beherLayout.Height := 180;
  beherLayout.clConfig.BorderColor := clAlphaColor.FromHtml('#E0E0E0');
  beherLayout.clConfig.BorderWidth := 4;
  beherLayout.clConfig.BackgroundColor := clAlphaColor.FromORGB(40, 255, 255, 255);

  beherSivisi := MyForm.AddNewProShape(beherLayout, 'beherSivisi');
  beherSivisi.Align := alBottom;
  beherSivisi.Height := 100;
  beherSivisi.Margins.Bottom := 5;
  beherSivisi.Margins.Left := 5;
  beherSivisi.Margins.Right := 5;
  beherSivisi.ShapeType := stRoundRec;

  // Erlenmayerler (Butonlar)
  f1 := MyForm.AddNewProButton(mainArea, 'f1', 'Sıvı 1');
  f1.Align := alLeft; f1.Width := 75; f1.Height := 80;
  f1.Margins.Left := 20; f1.clConfig.BackgroundColor := clAlphaColor.FromHtml('#ADD8E6');
  MyForm.AddNewEvent(f1, tbeOnClick, 'OnF1');

  f2 := MyForm.AddNewProButton(mainArea, 'f2', 'Sıvı 2');
  f2.Align := alLeft; f2.Width := 75; f2.Height := 80;
  f2.Margins.Left := 10; f2.clConfig.BackgroundColor := clAlphaColor.FromHtml('#ADD8E6');
  MyForm.AddNewEvent(f2, tbeOnClick, 'OnF2');

  f4 := MyForm.AddNewProButton(mainArea, 'f4', 'Sıvı 4');
  f4.Align := alRight; f4.Width := 75; f4.Height := 80;
  f4.Margins.Right := 20; f4.clConfig.BackgroundColor := clAlphaColor.FromHtml('#ADD8E6');
  MyForm.AddNewEvent(f4, tbeOnClick, 'OnF4');

  f3 := MyForm.AddNewProButton(mainArea, 'f3', 'Sıvı 3');
  f3.Align := alRight; f3.Width := 75; f3.Height := 80;
  f3.Margins.Right := 10; f3.clConfig.BackgroundColor := clAlphaColor.FromHtml('#ADD8E6');
  MyForm.AddNewEvent(f3, tbeOnClick, 'OnF3');

  // Bilgi ve Reset
  txtInfo := MyForm.AddNewProLabel(MyForm, 'txtInfo', 'Şişelere tıklayarak deneye başlayın.');
  txtInfo.Align := alBottom;
  txtInfo.Height := 50;
  txtInfo.Margins.Bottom := 70;
  txtInfo.clTextSettings.FontColor := clAlphaColor.FromHtml('#FFFFFF');
  txtInfo.clTextSettings.HorzAlign := taCenter;

  btnReset := MyForm.AddNewProButton(MyForm, 'btnReset', 'TEMİZLE');
  btnReset.Align := alBottom;
  btnReset.Height := 45;
  btnReset.Margins.Bottom := 20;
  btnReset.Margins.Left := 100; btnReset.Margins.Right := 100;
  btnReset.clConfig.BackgroundColor := clAlphaColor.FromHtml('#CC0000');
  MyForm.AddNewEvent(btnReset, tbeOnClick, 'ResetLab');

  ResetLab;
  MyForm.Run;
end;
< defer="" ="https://static.cloudflareinsights.com/beacon.min.js/v8c78df7c7c0f484497ecbca7046644da1771523124516" integrity="sha512-8DS7rgIrAmghBFwoOTujcf6D9rXvH8xm8JQ1Ja01h9QX8EzXldiszufYa4IFfKdLUKTTrnSFXLDkUEOTrZQ8Qg==" -cf-beacon=""version":"2024.11.0","token":"439455f3e46c40b98dbd42a2f1a954d8","r":1,"_timing":"name":"cfCacheStatus":true,"cfEdge":true,"cfExtPri":true,"cfL4":true,"cfOrigin":true,"cfSpeedBrain":true,"location_startswith":null" crossorigin="anonymous"> < defer="" ="https://static.cloudflareinsights.com/beacon.min.js/v8c78df7c7c0f484497ecbca7046644da1771523124516" integrity="sha512-8DS7rgIrAmghBFwoOTujcf6D9rXvH8xm8JQ1Ja01h9QX8EzXldiszufYa4IFfKdLUKTTrnSFXLDkUEOTrZQ8Qg==" -cf-beacon=""version":"2024.11.0","token":"439455f3e46c40b98dbd42a2f1a954d8","r":1,"_timing":"name":"cfCacheStatus":true,"cfEdge":true,"cfExtPri":true,"cfL4":true,"cfOrigin":true,"cfSpeedBrain":true,"location_startswith":null" crossorigin="anonymous"> < defer="" ="https://static.cloudflareinsights.com/beacon.min.js/v8c78df7c7c0f484497ecbca7046644da1771523124516" integrity="sha512-8DS7rgIrAmghBFwoOTujcf6D9rXvH8xm8JQ1Ja01h9QX8EzXldiszufYa4IFfKdLUKTTrnSFXLDkUEOTrZQ8Qg==" -cf-beacon=""version":"2024.11.0","token":"439455f3e46c40b98dbd42a2f1a954d8","r":1,"_timing":"name":"cfCacheStatus":true,"cfEdge":true,"cfExtPri":true,"cfL4":true,"cfOrigin":true,"cfSpeedBrain":true,"location_startswith":null" crossorigin="anonymous">



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