Sayfayı Yazdır | Pencereyi Kapat

if kısmında hata

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=1101
Tarih: 18 Temmuz 2025 Saat 19:05
Program Versiyonu: Web Wiz Forums 12.07 - https://www.webwizforums.com


Konu: if kısmında hata
Mesajı Yazan: dilarayaprak
Konu: if kısmında hata
Mesaj Tarihi: 18 Temmuz 2025 Saat 13:16
Kullanıcının yazdığı İngilizce kelime GPT’ye gönderen, gelen Türkçe çeviri kartın ön ve arka yüzünde gösteren ve kart tıklanınca yüz değiştirilen bir kod yazdım ama if kısmında surekli hata alıyorum, yardımcı olur musunuz
-------------------------------------------------------------------------------------------
var
  kelimeForm: TclForm;
  kartPanel: TclProPanel;
  frontFace, backFace: TclProPanel;
  lblEnglish, lblTurkish: TclProLabel;
  txtInput: TclProEdit;
  btnSorgula: TclProButton;
  MyOpenAIEngine: TclOpenAIEngine;

void BtnSorgulaClick;

{
if txtInput.Text = ''
{
ShowMessage('Lütfen bir kelime girin!')
else 
{
   lblEnglish.Caption = txtInput.Text
   lblTurkish.Caption = ''
   backFace.Visible = False
   frontFace.Visible = True

   MyOpenAIEngine.SendAIMessage(
      'Translate the word "' + txtInput.Text + '" into Turkish. Only return the translation.'
   )

   txtInput.Text = ''
}

}

void GetAIResponse
{
  lblTurkish.Caption = MyOpenAIEngine.NewMessageContent;
  backFace.Visible = False;
  frontFace.Visible = True;
}

void FlipCard
{
  if frontFace.Visible = True {
    frontFace.Visible = False;
    backFace.Visible = True;
  } else {
    frontFace.Visible = True;
    backFace.Visible = False;
  }
}

{
  kelimeForm = TclForm.Create(Self);

  kelimeForm.Caption = 'İngilizce → Türkçe Kart';
  kelimeForm.SetFormBGImage(' https://i.imgur.com/fPwWs0H.jpeg" rel="nofollow - https://i.imgur.com/fPwWs0H.jpeg ');

  txtInput = kelimeForm.AddNewProEdit(kelimeForm, 'txtInput', '');
  txtInput.Align = alTop;
  txtInput.Margins.Top = 20;
  txtInput.Height = 40;

  btnSorgula = kelimeForm.AddNewProButton(kelimeForm, 'btnSorgula', 'ÇEVİR');
  btnSorgula.Align = alTop;
  btnSorgula.Height = 40;
  kelimeForm.AddNewEvent(btnSorgula, tbeOnClick, 'BtnSorgulaClick');
  
  
  kartPanel = kelimeForm.AddNewProPanel(kelimeForm, 'kartPanel');
  kartPanel.Align = alCenter;
  kartPanel.Width = 300;
  kartPanel.Height = 150;
  kartPanel.ClProSettings.FillColor = clAlphaColor.clHexToColor('#ffffff');
  kartPanel.ClProSettings.RoundWidth = 20;
  kartPanel.ClProSettings.RoundHeight = 20;
  kartPanel.SetclProSettings(kartPanel.ClProSettings);


  frontFace = kelimeForm.AddNewProPanel(kartPanel, 'frontFace');
  frontFace.Align = alClient;
  frontFace.Visible = True;

  lblEnglish = kelimeForm.AddNewProLabel(frontFace, 'lblEnglish', '');
  lblEnglish.Align = alCenter;
  lblEnglish.ClProSettings.FontSize = 20;


  backFace = kelimeForm.AddNewProPanel(kartPanel, 'backFace');
  backFace.Align = alClient;
  backFace.Visible = False;

  lblTurkish = kelimeForm.AddNewProLabel(backFace, 'lblTurkish', '');
  lblTurkish.Align = alCenter;
  lblTurkish.ClProSettings.FontSize = 20;

  MyOpenAIEngine = TclOpenAIEngine.Create(Self);
  MyOpenAIEngine.ParentForm = kelimeForm;
  MyOpenAIEngine.ApiKey = 'skxxxxxxxxxxxxxx;
  MyOpenAIEngine.OnNewMessageEvent = 'GetAIResponse';

  kelimeForm.AddNewEvent(btnSorgula, tbeOnClick, 'BtnSorgulaClick');
  kelimeForm.AddNewEvent(kartPanel, tbeOnClick, 'FlipCard');

  kelimeForm.Run;
}



Cevaplar:
Mesajı Yazan: haletr
Mesaj Tarihi: 18 Temmuz 2025 Saat 13:22
Merhaba, 

if (txtInput.Text == '') //== koyuyoruz eşit mi değil mi? sorgusu yapıyoruz
{
ShowMessage('Lütfen bir kelime girin!')

bu şekilde deneyebilir misin? İyi çalışmalar.


Mesajı Yazan: Sudesigirci
Mesaj Tarihi: 18 Temmuz 2025 Saat 13:36
Merhaba Dilara ,
if sorgusunu düzelttikten sonra da çalışmayabilir ben de TclOpenAIEngine bileşenini bir projemde kullanmak istemiştim fakat OpenAı kendini güncellediği için bileşenin de güncellenmesi gerekiyormuş güncelleme yapıldı mı bilmiyorum eğer çalışmazsa bundan kaynaklı olabilir TclRest bileşeni kullanarak da projene yapay zeka entegre edebilirsin

detaylı incelemen için
https://www.docs.clomosy.com/TclRest" rel="nofollow - https://www.docs.clomosy.com/TclRest

İyi çalışmalar dilerim.



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