Clomosy | Forum Ana Sayfa
Forum Anasayfa Forum Anasayfa > Genel Programlama > Clomosy ile değişken kullanımı
  Aktif Konular Aktif Konular RSS - ödev kodlarda hata
  SSS SSS  Forumu Ara   Etkinlikler   Kayıt Ol Kayıt Ol  Giriş Giriş

Clomosy Resmi Forum Sitesidir. Amacımız kullanıcılarımıza, iş ortaklarımıza, danışmanlara, yazılımcılara programlarımız hakkında destek ve bilgi vermektir.

ödev kodlarda hata

 Yanıt Yaz Yanıt Yaz
Yazar
Mesaj
  Konu Arama Konu Arama  Topic Seçenekleri Topic Seçenekleri
erenertankef Açılır Kutu İzle
Yeni Üye
Yeni Üye


Kayıt Tarihi: 6 Saat 57 Dakika Önce
Durum: Aktif Değil
Puanlar: 4
Mesaj Seçenekleri Mesaj Seçenekleri   Teşekkürler (0) Teşekkürler(0)   Alıntı erenertankef Alıntı  Yanıt YazCevapla Mesajın Direkt Linki Konu: ödev kodlarda hata
    Gönderim Zamanı: 6 Saat 16 Dakika Önce Saat 19:05
var
  MyForm: TclForm;
  TitleLabel, InfoLabel: TclProLabel;
  CylinderPanel: TclProPanel;
  Liquid1, Liquid2, Liquid3, Liquid4, Liquid5: TclProPanel;
  BtnBal, BtnSabun, BtnSu, BtnYag, BtnAlkol: TclProButton;
  MainVertBox, BtnFlowBox: TclLayout;
  CurrentStep: Integer;
  LabImage: TclImage;

void SetupLiquids;
{
  Liquid1.Visible = False;
  Liquid2.Visible = False;
  Liquid3.Visible = False;
  Liquid4.Visible = False;
  Liquid5.Visible = False;
  CurrentStep = 1;
}

void CheckDensity;
var
  ClickedTag: Integer;
{
  ClickedTag = TclProButton(MyForm.LastEventSender).Tag;
  
  if (ClickedTag == CurrentStep)
  {
    if (CurrentStep == 1) {Liquid1.Visible = True; ShowMessage('Bal (d=1.42) en yoğun olduğu için en alta yerleşti!');}
    if (CurrentStep == 2) {Liquid2.Visible = True; ShowMessage('Bulaşık Sabunu (d=1.06) Balın üzerine çıktı.');}
    if (CurrentStep == 3) {Liquid3.Visible = True; ShowMessage('Su (d=1.00) Sabunun üzerinde duruyor.');}
    if (CurrentStep == 4) {Liquid4.Visible = True; ShowMessage('Zeytinyağı (d=0.92) Suyun üstünde yüzüyor!');}
    if (CurrentStep == 5) {Liquid5.Visible = True; ShowMessage('Tebrikler! Alkol (d=0.80) en üstte. Yoğunluk Kulesi Tamamlandı!');}
    
    CurrentStep = CurrentStep + 1;
  }
  else
  {
    ShowMessage('Hatalı Sıralama! Yoğunluğu daha fazla olan bir madde seçmelisin.');
  }
}

{
  MyForm = TclForm.Create(Self);
  
  // Arka Plan Görseli
  LabImage = MyForm.AddNewImage(MyForm, 'LabImage');
  LabImage.Align = alContents;

  MainVertBox = MyForm.AddNewLayout(MyForm, 'MainVertBox');
  MainVertBox.Align = alContents;

  TitleLabel = MyForm.AddNewProLabel(MainVertBox, 'TitleLabel', 'FEN BİLGİSİ: YOĞUNLUK KULESİ');
  clComponent.SetupComponent(TitleLabel, '{"Align":"Top","MarginTop":20,"MarginBottom":10,"Height":40,"TextHorizontalAlign":"Center","TextBold":"yes","FontSize":22,"FontColor":"#FFFFFF"}');

  InfoLabel = MyForm.AddNewProLabel(MainVertBox, 'InfoLabel', 'Sıvıları en yoğundan en az yoğuna doğru mezüre ekle!');
  clComponent.SetupComponent(InfoLabel, '{"Align":"Top","Height":30,"TextHorizontalAlign":"Center","FontSize":14,"FontColor":"#E1E1E1"}');

  // Mezür Tasarımı (Cylinder)
  CylinderPanel = MyForm.AddNewProPanel(MainVertBox, 'CylinderPanel');
  clComponent.SetupComponent(CylinderPanel, '{"Align":"Center","Width":150,"Height":350,"BackgroundColor":"#50FFFFFF","RoundHeight":20,"RoundWidth":20,"BorderColor":"#FFFFFF","BorderWidth":2}');

  // Sıvı Katmanları (Aşağıdan yukarıya 1-5)
  Liquid1 = MyForm.AddNewProPanel(CylinderPanel, 'Liquid1'); // Bal
  clComponent.SetupComponent(Liquid1, '{"Align":"Bottom","Height":60,"BackgroundColor":"#8B4513","MarginLeft":5,"MarginRight":5,"MarginBottom":5,"RoundHeight":10,"RoundWidth":10}');
  
  Liquid2 = MyForm.AddNewProPanel(CylinderPanel, 'Liquid2'); // Sabun
  clComponent.SetupComponent(Liquid2, '{"Align":"Bottom","Height":60,"BackgroundColor":"#228B22","MarginLeft":5,"MarginRight":5,"RoundHeight":5,"RoundWidth":5}');
  
  Liquid3 = MyForm.AddNewProPanel(CylinderPanel, 'Liquid3'); // Su
  clComponent.SetupComponent(Liquid3, '{"Align":"Bottom","Height":60,"BackgroundColor":"#00BFFF","MarginLeft":5,"MarginRight":5}');
  
  Liquid4 = MyForm.AddNewProPanel(CylinderPanel, 'Liquid4'); // Yağ
  clComponent.SetupComponent(Liquid4, '{"Align":"Bottom","Height":60,"BackgroundColor":"#FFD700","MarginLeft":5,"MarginRight":5}');
  
  Liquid5 = MyForm.AddNewProPanel(CylinderPanel, 'Liquid5'); // Alkol
  clComponent.SetupComponent(Liquid5, '{"Align":"Bottom","Height":60,"BackgroundColor":"#FF4500","MarginLeft":5,"MarginRight":5}');

  // Buton Alanı
  BtnFlowBox = MyForm.AddNewLayout(MainVertBox, 'BtnFlowBox');
  BtnFlowBox.Align = alBottom;
  BtnFlowBox.Height = 150;
  BtnFlowBox.Margins.Bottom = 20;

  // Butonlar ve Tag Atamaları (Yoğunluk sırasına göre Tag veriyoruz)
  BtnBal = MyForm.AddNewProButton(BtnFlowBox, 'BtnBal', 'BAL (1.42)');
  BtnBal.Tag = 1;
  clComponent.SetupComponent(BtnBal, '{"Align":"Top","MarginLeft":50,"MarginRight":50,"MarginTop":5,"Height":25,"BackgroundColor":"#8B4513","FontColor":"#FFFFFF","RoundHeight":10}');
  MyForm.AddNewEvent(BtnBal, tclOnClick, 'CheckDensity');

  BtnSabun = MyForm.AddNewProButton(BtnFlowBox, 'BtnSabun', 'SABUN (1.06)');
  BtnSabun.Tag = 2;
  clComponent.SetupComponent(BtnSabun, '{"Align":"Top","MarginLeft":50,"MarginRight":50,"MarginTop":5,"Height":25,"BackgroundColor":"#228B22","FontColor":"#FFFFFF","RoundHeight":10}');
  MyForm.AddNewEvent(BtnSabun, tclOnClick, 'CheckDensity');

  BtnSu = MyForm.AddNewProButton(BtnFlowBox, 'BtnSu', 'SU (1.00)');
  BtnSu.Tag = 3;
  clComponent.SetupComponent(BtnSu, '{"Align":"Top","MarginLeft":50,"MarginRight":50,"MarginTop":5,"Height":25,"BackgroundColor":"#00BFFF","FontColor":"#FFFFFF","RoundHeight":10}');
  MyForm.AddNewEvent(BtnSu, tclOnClick, 'CheckDensity');

  BtnYag = MyForm.AddNewProButton(BtnFlowBox, 'BtnYag', 'YAĞ (0.92)');
  BtnYag.Tag = 4;
  clComponent.SetupComponent(BtnYag, '{"Align":"Top","MarginLeft":50,"MarginRight":50,"MarginTop":5,"Height":25,"BackgroundColor":"#FFD700","FontColor":"#000000","RoundHeight":10}');
  MyForm.AddNewEvent(BtnYag, tclOnClick, 'CheckDensity');

  BtnAlkol = MyForm.AddNewProButton(BtnFlowBox, 'BtnAlkol', 'ALKOL (0.80)');
  BtnAlkol.Tag = 5;
  clComponent.SetupComponent(BtnAlkol, '{"Align":"Top","MarginLeft":50,"MarginRight":50,"MarginTop":5,"Height":25,"BackgroundColor":"#FF4500","FontColor":"#FFFFFF","RoundHeight":10}');
  MyForm.AddNewEvent(BtnAlkol, tclOnClick, 'CheckDensity');

  SetupLiquids;
  MyForm.Run;
}

hocam buda başka bir kod buda çalışmıyorhata veriyor düzeltemedik 
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">
Yukarı Dön
Emr.Erkmn Açılır Kutu İzle
Moderatör
Moderatör


Kayıt Tarihi: 28 Şubat 2025
Durum: Aktif Değil
Puanlar: 905
Mesaj Seçenekleri Mesaj Seçenekleri   Teşekkürler (0) Teşekkürler(0)   Alıntı Emr.Erkmn Alıntı  Yanıt YazCevapla Mesajın Direkt Linki Gönderim Zamanı: 4 Saat 28 Dakika Önce Saat 20:53
Merhabalar 

Öncelikle kodunu yazarken setupcomponent ile yazmamanı istiyorum clProsettings ile yazmanı istiyorum.

kodlama da kullandığında tag yalnız doğrusu clTagStr olması gerekli 



var
  MyForm: TclForm;
  TitleLabel, InfoLabel: TclProLabel;
  CylinderPanel: TclProPanel;
  Liquid1, Liquid2, Liquid3, Liquid4, Liquid5: TclProPanel;
  BtnBal, BtnSabun, BtnSu, BtnYag, BtnAlkol: TclProButton;
  MainVertBox, BtnFlowBox: TclLayout;
  CurrentStep: Integer;
  LabImage: TclImage;

void SetupLiquids;
{
  Liquid1.Visible = False;
  Liquid2.Visible = False;
  Liquid3.Visible = False;
  Liquid4.Visible = False;
  Liquid5.Visible = False;
  CurrentStep = 1;
}

void CheckDensity;
var
  ClickedTag: Integer;
  SenderBtn: TclProButton;
{
  SenderBtn = TclProButton(MyForm.clSender);
  ClickedTag = SenderBtn.clTagInt; 
  
  if (ClickedTag == CurrentStep)
  {
    if (CurrentStep == 1) 
    {
      Liquid1.Visible = True; 
      ShowMessage('Bal (d=1.42) en yoğun olduğu için en alta yerleşti!');
    }
    else if (CurrentStep == 2) 
    {
      Liquid2.Visible = True; 
      ShowMessage('Bulaşık Sabunu (d=1.06) Balın üzerine çıktı.');
    }
    else if (CurrentStep == 3) 
    {
      Liquid3.Visible = True; 
      ShowMessage('Su (d=1.00) Sabunun üzerinde duruyor.');
    }
    else if (CurrentStep == 4) 
    {
      Liquid4.Visible = True; 
      ShowMessage('Zeytinyağı (d=0.92) Suyun üstünde yüzüyor!');
    }
    else if (CurrentStep == 5) 
    {
      Liquid5.Visible = True; 
      ShowMessage('Tebrikler! Alkol (d=0.80) en üstte. Yoğunluk Kulesi Tamamlandı!');
    }
    
    CurrentStep = CurrentStep + 1;
  }
  else
  {
    ShowMessage('Hatalı Sıralama! Yoğunluğu daha fazla olan bir madde seçmelisin.');
  }
}

{
  MyForm = TclForm.Create(Self);
  
  LabImage = MyForm.AddNewImage(MyForm, 'LabImage');
  LabImage.Align = alContents;

  MainVertBox = MyForm.AddNewLayout(MyForm, 'MainVertBox');
  MainVertBox.Align = alContents;

  TitleLabel = MyForm.AddNewProLabel(MainVertBox, 'TitleLabel', 'FEN BİLGİSİ: YOĞUNLUK KULESİ');
  TitleLabel.Align = alTop;
  TitleLabel.Height = 40;
  TitleLabel.Margins.Top = 20;
  TitleLabel.clProSettings.FontSize = 22;
  TitleLabel.clProSettings.FontColor = clAlphaColor.clWhite;
  TitleLabel.clProSettings.FontHorzAlign = palCenter;
  TitleLabel.clProSettings.TextSettings.Font.Style = [fsBold];
  TitleLabel.SetclProSettings(TitleLabel.clProSettings);

  InfoLabel = MyForm.AddNewProLabel(MainVertBox, 'InfoLabel', 'Sıvıları en yoğundan en az yoğuna doğru mezüre ekle!');
  InfoLabel.Align = alTop;
  InfoLabel.Height = 30;
  InfoLabel.clProSettings.FontSize = 14;
  InfoLabel.clProSettings.FontColor = clAlphaColor.clHexToColor('#E1E1E1');
  InfoLabel.clProSettings.FontHorzAlign = palCenter;
  InfoLabel.SetclProSettings(InfoLabel.clProSettings);

  CylinderPanel = MyForm.AddNewProPanel(MainVertBox, 'CylinderPanel');
  CylinderPanel.Align = alCenter;
  CylinderPanel.Width = 150;
  CylinderPanel.Height = 350;
  CylinderPanel.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#50FFFFFF');
  CylinderPanel.clProSettings.BorderColor = clAlphaColor.clWhite;
  CylinderPanel.clProSettings.BorderWidth = 2;
  CylinderPanel.clProSettings.RoundWidth = 20;
  CylinderPanel.clProSettings.RoundHeight = 20;
  CylinderPanel.SetclProSettings(CylinderPanel.clProSettings);

  Liquid1 = MyForm.AddNewProPanel(CylinderPanel, 'Liquid1');
  Liquid1.Align = alBottom;
  Liquid1.Height = 60;
  Liquid1.Margins.Left = 5; Liquid1.Margins.Right = 5; Liquid1.Margins.Bottom = 5;
  Liquid1.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#8B4513');
  Liquid1.clProSettings.RoundWidth = 10; Liquid1.clProSettings.RoundHeight = 10;
  Liquid1.SetclProSettings(Liquid1.clProSettings);

  Liquid2 = MyForm.AddNewProPanel(CylinderPanel, 'Liquid2');
  Liquid2.Align = alBottom;
  Liquid2.Height = 60;
  Liquid2.Margins.Left = 5; Liquid2.Margins.Right = 5;
  Liquid2.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#228B22');
  Liquid2.SetclProSettings(Liquid2.clProSettings);

  Liquid3 = MyForm.AddNewProPanel(CylinderPanel, 'Liquid3');
  Liquid3.Align = alBottom;
  Liquid3.Height = 60;
  Liquid3.Margins.Left = 5; Liquid3.Margins.Right = 5;
  Liquid3.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#00BFFF');
  Liquid3.SetclProSettings(Liquid3.clProSettings);

  Liquid4 = MyForm.AddNewProPanel(CylinderPanel, 'Liquid4');
  Liquid4.Align = alBottom;
  Liquid4.Height = 60;
  Liquid4.Margins.Left = 5; Liquid4.Margins.Right = 5;
  Liquid4.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#FFD700');
  Liquid4.SetclProSettings(Liquid4.clProSettings);

  Liquid5 = MyForm.AddNewProPanel(CylinderPanel, 'Liquid5');
  Liquid5.Align = alBottom;
  Liquid5.Height = 60;
  Liquid5.Margins.Left = 5; Liquid5.Margins.Right = 5;
  Liquid5.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#FF4500');
  Liquid5.SetclProSettings(Liquid5.clProSettings);

  BtnFlowBox = MyForm.AddNewLayout(MainVertBox, 'BtnFlowBox');
  BtnFlowBox.Align = alBottom;
  BtnFlowBox.Height = 180;

  BtnBal = MyForm.AddNewProButton(BtnFlowBox, 'BtnBal', 'BAL (1.42)');
  BtnBal.Align = alTop;
  BtnBal.Height = 30;
  BtnBal.Margins.Left = 50; BtnBal.Margins.Right = 50; BtnBal.Margins.Top = 5;
  BtnBal.clTagInt = 1; // Tag ataması
  BtnBal.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#8B4513');
  BtnBal.clProSettings.FontColor = clAlphaColor.clWhite;
  BtnBal.clProSettings.RoundWidth = 10; BtnBal.clProSettings.RoundHeight = 10;
  BtnBal.SetclProSettings(BtnBal.clProSettings);
  MyForm.AddNewEvent(BtnBal, tbeonclick, 'CheckDensity');

  BtnSabun = MyForm.AddNewProButton(BtnFlowBox, 'BtnSabun', 'SABUN (1.06)');
  BtnSabun.Align = alTop;
  BtnSabun.Height = 30;
  BtnSabun.Margins.Left = 50; BtnSabun.Margins.Right = 50; BtnSabun.Margins.Top = 5;
  BtnSabun.clTagInt = 2;
  BtnSabun.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#228B22');
  BtnSabun.clProSettings.FontColor = clAlphaColor.clWhite;
  BtnSabun.clProSettings.RoundWidth = 10; BtnSabun.clProSettings.RoundHeight = 10;
  BtnSabun.SetclProSettings(BtnSabun.clProSettings);
  MyForm.AddNewEvent(BtnSabun, tbeonclick, 'CheckDensity');

  BtnSu = MyForm.AddNewProButton(BtnFlowBox, 'BtnSu', 'SU (1.00)');
  BtnSu.Align = alTop;
  BtnSu.Height = 30;
  BtnSu.Margins.Left = 50; BtnSu.Margins.Right = 50; BtnSu.Margins.Top = 5;
  BtnSu.clTagInt = 3;
  BtnSu.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#00BFFF');
  BtnSu.clProSettings.FontColor = clAlphaColor.clWhite;
  BtnSu.clProSettings.RoundWidth = 10; BtnSu.clProSettings.RoundHeight = 10;
  BtnSu.SetclProSettings(BtnSu.clProSettings);
  MyForm.AddNewEvent(BtnSu, tbeonclick, 'CheckDensity');

  BtnYag = MyForm.AddNewProButton(BtnFlowBox, 'BtnYag', 'YAĞ (0.92)');
  BtnYag.Align = alTop;
  BtnYag.Height = 30;
  BtnYag.Margins.Left = 50; BtnYag.Margins.Right = 50; BtnYag.Margins.Top = 5;
  BtnYag.clTagInt = 4;
  BtnYag.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#FFD700');
  BtnYag.clProSettings.FontColor = clAlphaColor.clBlack;
  BtnYag.clProSettings.RoundWidth = 10; BtnYag.clProSettings.RoundHeight = 10;
  BtnYag.SetclProSettings(BtnYag.clProSettings);
  MyForm.AddNewEvent(BtnYag, tbeonclick, 'CheckDensity');

  BtnAlkol = MyForm.AddNewProButton(BtnFlowBox, 'BtnAlkol', 'ALKOL (0.80)');
  BtnAlkol.Align = alTop;
  BtnAlkol.Height = 30;
  BtnAlkol.Margins.Left = 50; BtnAlkol.Margins.Right = 50; BtnAlkol.Margins.Top = 5;
  BtnAlkol.clTagInt = 5;
  BtnAlkol.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#FF4500');
  BtnAlkol.clProSettings.FontColor = clAlphaColor.clWhite;
  BtnAlkol.clProSettings.RoundWidth = 10; BtnAlkol.clProSettings.RoundHeight = 10;
  BtnAlkol.SetclProSettings(BtnAlkol.clProSettings);
  MyForm.AddNewEvent(BtnAlkol, tbeonclick, 'CheckDensity');

  SetupLiquids;
  MyForm.Run;
}
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">
Yukarı Dön
 Yanıt Yaz Yanıt Yaz

Forum Atla Forum İzinleri Açılır Kutu İzle

Forum Software by Web Wiz Forums® version 12.07
Copyright ©2001-2024 Web Wiz Ltd.

Bu Sayfa 0,032 Saniyede Yüklendi.