Clomosy | Forum Ana Sayfa
Forum Anasayfa Forum Anasayfa > Genel Programlama > Clomosy ile değişken kullanımı
  Aktif Konular Aktif Konular RSS - Kodda Fİlm özellikleri göstermeme HATASI!
  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.

Kodda Fİlm özellikleri göstermeme HATASI!

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

Kayıt Tarihi: 03 Aralık 2025
Durum: Aktif Değil
Puanlar: 21
Mesaj Seçenekleri Mesaj Seçenekleri   Teşekkürler (0) Teşekkürler(0)   Alıntı Hüseyin_Sadik Alıntı  Yanıt YazCevapla Mesajın Direkt Linki Konu: Kodda Fİlm özellikleri göstermeme HATASI!
    Gönderim Zamanı: 11 Saat 51 Dakika Önce Saat 09:47
var
  MainForm : TclForm;
  BgPanel, TopPanel, CardPanel, FilterPanel, FavoritesPanel, Top10Panel : TclProPanel;
  ContentPanel, ActionButtonPanel : TclProPanel;

  BtnStart, BtnNext, BtnFav, BtnFavorites, BtnTop10 : TClProButton;

  BtnUS, BtnKR, BtnTR : TClProButton;
  BtnAction, BtnComedy, BtnDrama, BtnHorror : TClProButton;

  MovieImage : TclProImage;
  LblTitle, LblInfo, LblOverview : TClProLabel;
  
  IntroPanel : TclProPanel;
  IntroTitleLabel, IntroSubLabel : TClProLabel;

  Rest : TclRest;

  SelectedCountry, SelectedGenre, CurrentMovieID : String;
  FavoriteList : TclStringList;

  movieTitle, overview, posterPath, vote, releaseDate, posterUrl : String;
  randomIndex, randomPage : Integer;
  URL, API_KEY, BASE_URL : String;

// ================= API =================

void ApiCompleted;
{
  randomIndex = Random(20);

  CurrentMovieID = Clomosy.CLParseJSON(Rest.Response,'results.'+IntToStr(randomIndex)+'.id');
  movieTitle  = Clomosy.CLParseJSON(Rest.Response,'results.'+IntToStr(randomIndex)+'.title');
  overview    = Clomosy.CLParseJSON(Rest.Response,'results.'+IntToStr(randomIndex)+'.overview');
  posterPath  = Clomosy.CLParseJSON(Rest.Response,'results.'+IntToStr(randomIndex)+'.poster_path');
  vote        = Clomosy.CLParseJSON(Rest.Response,'results.'+IntToStr(randomIndex)+'.vote_average');
  releaseDate = Clomosy.CLParseJSON(Rest.Response,'results.'+IntToStr(randomIndex)+'.release_date');

  if releaseDate <> ''
    releaseDate = Copy(releaseDate,1,4);

  LblTitle.Text = movieTitle;
  LblInfo.Text = '⭐ ' + vote + '  |  📅 ' + releaseDate;
  LblOverview.Text = overview;

  if posterPath <> ''
  {
    posterUrl = 'https://image.tmdb.org/t/p/w500'+posterPath;
    MovieImage.clProSettings.PictureSource = posterUrl;
    MovieImage.SetclProSettings(MovieImage.clProSettings);
  }

  Rest.Free;
  Rest = Nil;
}

void GetMovie;
{
  randomPage = Random(10)+1;

  URL = BASE_URL + '/discover/movie?api_key='+API_KEY+'&language=tr-TR&sort_by=popularity.desc&page='+IntToStr(randomPage);

  if SelectedGenre <> ''
    URL = URL + '&with_genres=' + SelectedGenre;

  if SelectedCountry <> ''
    URL = URL + '&with_origin_country=' + SelectedCountry;

  Rest = TclRest.Create;
  Rest.Accept = 'application/json';
  Rest.Method = rmGET;
  Rest.BaseURL = URL;
  Rest.OnCompleted = 'ApiCompleted';
  Rest.ExecuteAsync;
}

// ================= FILTER FUNCTIONS =================

void SelectTR; { SelectedCountry = ''; SelectedGenre = ''; GetMovie; }
void SelectUS; { SelectedCountry = 'US'; GetMovie; }
void SelectAction; { SelectedGenre = '28'; GetMovie; }
void SelectComedy; { SelectedGenre = '35'; GetMovie; }
void SelectDrama; { SelectedGenre = '18'; GetMovie; }

// ================= FAVORITES =================

void AddFavorite;
var i : Integer;
var Exists : Boolean;
var Item : String;
{
  Exists = False;

  for (i = 0 to FavoriteList.Count - 1)
  {
    Item = Clomosy.StringListItemString(FavoriteList,i);
    if Pos(CurrentMovieID+'|', Item) == 1
      Exists = True;
  }

  if Exists == False
  {
    FavoriteList.Add(CurrentMovieID + '|' + posterPath + '|' + movieTitle);
    ShowMessage('İzleme listene eklendi! 🍿');
  }
  else
    ShowMessage('Bu film zaten listende var.');
}

void ShowFavorites;
var i : Integer;
var Item, Poster : String;
var Img : TclProImage;
var SplitList : TclStringList;
{
  FavoritesPanel.Visible = True;
  CardPanel.Visible = False;
  FilterPanel.Visible = False;
  ActionButtonPanel.Visible = False;
  Top10Panel.Visible = False;

  FavoritesPanel.DeleteChildren;

  for (i = 0 to FavoriteList.Count - 1)
  {
    Item = Clomosy.StringListItemString(FavoriteList,i);

    SplitList = Clomosy.StringListNew;
    SplitList.StrictDelimiter = True;
    SplitList.Delimiter = '|';
    SplitList.DelimitedText = Item;

    Poster = Clomosy.StringListItemString(SplitList,1);

    Img = MainForm.AddNewProImage(FavoritesPanel,'FavImg'+IntToStr(i));
    Img.Align = alTop;
    Img.Height = 240;
    Img.Margins.Top = 15;
    Img.Margins.Left = 30;
    Img.Margins.Right = 30;
    Img.clProSettings.RoundHeight = 16;
    Img.clProSettings.RoundWidth = 16;
    Img.clProSettings.PictureAutoFit = True;
    Img.clProSettings.PictureSource = 'https://image.tmdb.org/t/p/w500'+Poster;
    Img.SetclProSettings(Img.clProSettings);

    SplitList.Free;
  }
}

void ToggleFavorites;
{
  if FavoritesPanel.Visible == True
  {
    FavoritesPanel.Visible = False;
    CardPanel.Visible = True;
    FilterPanel.Visible = True;
    ActionButtonPanel.Visible = True;
  }
  else
    ShowFavorites;
}

// ================= TOP 10 =================

void ToggleTop10;
var i : Integer;
var poster, title : String;
var FilmPanel : TclProPanel;
var Img : TclProImage;
var Lbl : TclProLabel;
{
  if Top10Panel.Visible == True
  {
    Top10Panel.Visible = False;
    CardPanel.Visible = True;
    FilterPanel.Visible = True;
    ActionButtonPanel.Visible = True;
  }
  else
  {
    Top10Panel.Visible = True;
    CardPanel.Visible = False;
    FilterPanel.Visible = False;
    ActionButtonPanel.Visible = False;
    FavoritesPanel.Visible = False;

    Top10Panel.DeleteChildren;

    Rest = TclRest.Create;
    Rest.Accept = 'application/json';
    Rest.Method = rmGET;
    Rest.BaseURL = BASE_URL + '/discover/movie?api_key='+API_KEY+'&language=tr-TR&sort_by=popularity.desc&page=1';
    Rest.Execute;

    for (i = 0 to 9)
    {
      poster = Clomosy.CLParseJSON(Rest.Response,'results.'+IntToStr(i)+'.poster_path');
      title  = Clomosy.CLParseJSON(Rest.Response,'results.'+IntToStr(i)+'.title');

      FilmPanel = MainForm.AddNewProPanel(Top10Panel,'FilmPanel'+IntToStr(i));
      FilmPanel.Align = alLeft;
      FilmPanel.Width = 120;
      FilmPanel.Margins.Left = 2;
      FilmPanel.Margins.Right = 2;

      Img = MainForm.AddNewProImage(FilmPanel,'TopImg'+IntToStr(i));
      Img.Align = alTop;
      Img.Height = 160;
      Img.clProSettings.PictureAutoFit = True;
      Img.clProSettings.PictureSource = 'https://image.tmdb.org/t/p/w500'+poster;
      Img.SetclProSettings(Img.clProSettings);

      Lbl = MainForm.AddNewProLabel(FilmPanel,'TopLbl'+IntToStr(i),title);
      Lbl.Align = alBottom;
      Lbl.Height = 40;
      Lbl.clProSettings.FontColor = clAlphaColor.clWhite;
      Lbl.clProSettings.FontSize = 10;
      Lbl.clProSettings.WordWrap = True;
      Lbl.SetclProSettings(Lbl.clProSettings);
    }

    Rest.Free;
    Rest = Nil;
  }
}

void StartApp;
{
  IntroPanel.Visible = False; 
  
  CardPanel.Visible = True;
  FilterPanel.Visible = True;
  ActionButtonPanel.Visible = True;
  GetMovie;
}

// ================= MAIN =================

{
  API_KEY = 'bdadefeeb1178a602f57e923fef4255f';

  SelectedCountry = '';
  SelectedGenre = '';
  FavoriteList = Clomosy.StringListNew;

  MainForm = TclForm.Create(Self);

  // --- ARKA PLAN ---
  BgPanel = MainForm.AddNewProPanel(MainForm,'BgPanel');
  BgPanel.Align = alClient;
  BgPanel.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#000000'); 
  BgPanel.clProSettings.IsFill = True;
  BgPanel.SetclProSettings(BgPanel.clProSettings);

    // --- ÜST HEADER ---
  TopPanel = MainForm.AddNewProPanel(BgPanel,'TopPanel');
  TopPanel.Align = alTop;
  TopPanel.Height = 60;
  TopPanel.Margins.Left = 15;
  TopPanel.Margins.Right = 15;

  // Favoriler Butonu
  BtnFavorites = MainForm.AddNewProButton(TopPanel,'BtnFavorites','İzleme Listem 📂');
  BtnFavorites.Align = alRight;
  BtnFavorites.Width = 130;
  BtnFavorites.Margins.Top = 12;
  BtnFavorites.Margins.Bottom = 12;
  BtnFavorites.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#121212');
  BtnFavorites.clProSettings.FontColor = clAlphaColor.clWhite;
  BtnFavorites.clProSettings.FontSize = 11;
  BtnFavorites.clProSettings.RoundHeight = 12;
  BtnFavorites.clProSettings.RoundWidth = 12;
  BtnFavorites.clProSettings.BorderColor = clAlphaColor.clHexToColor('#333333');
  BtnFavorites.clProSettings.BorderWidth = 1;
  BtnFavorites.clProSettings.IsFill = True;
  BtnFavorites.clProSettings.TextSettings.Font.Style = [fsBold];
  BtnFavorites.SetclProSettings(BtnFavorites.clProSettings);
  MainForm.AddNewEvent(BtnFavorites,tbeOnClick,'ToggleFavorites');

  // Top 10 Butonu
  BtnTop10 = MainForm.AddNewProButton(TopPanel,'BtnTop10','Top 10 🔥');
  BtnTop10.Align = alRight;
  BtnTop10.Width = 100;
  BtnTop10.Margins.Top = 12;
  BtnTop10.Margins.Bottom = 12;
  BtnTop10.clProSettings = BtnFavorites.clProSettings;
  BtnTop10.SetclProSettings(BtnTop10.clProSettings);
  MainForm.AddNewEvent(BtnTop10,tbeOnClick,'ToggleTop10');

  // --- GİRİŞ PANELİ ---
  IntroPanel = MainForm.AddNewProPanel(BgPanel,'IntroPanel');
  IntroPanel.Align = alCenter;
  IntroPanel.Width = 320;
  IntroPanel.Height = 380;
  IntroPanel.clProSettings.BackgroundColor = clAlphaColor.clNull;
  IntroPanel.clProSettings.IsFill = True;
  IntroPanel.SetclProSettings(IntroPanel.clProSettings);

  IntroTitleLabel = MainForm.AddNewProLabel(IntroPanel,'IntroTitleLabel','🍿' + #13#10 + 'Ne' + #13#10 + 'İzlesem?');
  IntroTitleLabel.Align = alTop;
  IntroTitleLabel.Height = 160;
  IntroTitleLabel.clProSettings.FontColor = clAlphaColor.clHexToColor('#E50914'); 
  IntroTitleLabel.clProSettings.FontSize = 36;
  IntroTitleLabel.clProSettings.TextSettings.Font.Style = [fsBold];
  IntroTitleLabel.clProSettings.TextSettings.HorzAlign = palCenter;
  IntroTitleLabel.SetclProSettings(IntroTitleLabel.clProSettings);

  IntroSubLabel = MainForm.AddNewProLabel(IntroPanel,'IntroSubLabel','Kararsız mısın? Sana en uygun filmi saniyeler içinde bulalım.');
  IntroSubLabel.Align = alTop;
  IntroSubLabel.Height = 60;
  IntroSubLabel.Margins.Top = 10;
  IntroSubLabel.clProSettings.FontColor = clAlphaColor.clHexToColor('#8E8E93');
  IntroSubLabel.clProSettings.FontSize = 13;
  IntroSubLabel.clProSettings.WordWrap = True;
  IntroSubLabel.clProSettings.TextSettings.HorzAlign = palCenter;
  IntroSubLabel.SetclProSettings(IntroSubLabel.clProSettings);

  BtnStart = MainForm.AddNewProButton(IntroPanel,'BtnStart','ÖNERİ GETİR ✨');
  BtnStart.Align = alBottom;
  BtnStart.Height = 50;
  BtnStart.Margins.Bottom = 10;
  BtnStart.Margins.Left = 20;
  BtnStart.Margins.Right = 20;
  BtnStart.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#E50914'); 
  BtnStart.clProSettings.FontColor = clAlphaColor.clWhite;
  BtnStart.clProSettings.FontSize = 14;
  BtnStart.clProSettings.TextSettings.Font.Style = [fsBold];
  BtnStart.clProSettings.RoundHeight = 22;
  BtnStart.clProSettings.RoundWidth = 22;
  BtnStart.clProSettings.IsFill = True;
  BtnStart.SetclProSettings(BtnStart.clProSettings);
  MainForm.AddNewEvent(BtnStart,tbeOnClick,'StartApp');

  // --- FİLTRE PANELİ ---
  FilterPanel = MainForm.AddNewProPanel(BgPanel,'FilterPanel');
  FilterPanel.Align = alTop;
  FilterPanel.Height = 50;
  FilterPanel.Margins.Left = 15;
  FilterPanel.Margins.Right = 15;
  FilterPanel.Visible = False;

  // --- FAVORİLER PANELİ ---
  FavoritesPanel = MainForm.AddNewProPanel(BgPanel,'FavoritesPanel');
  FavoritesPanel.Align = alClient;
  FavoritesPanel.Visible = False;

  // --- TOP 10 PANELİ ---
  Top10Panel = MainForm.AddNewProPanel(BgPanel,'Top10Panel');
  Top10Panel.Align = alClient;
  Top10Panel.Visible = False;

  // --- ANA FİLM KARTI ---
  CardPanel = MainForm.AddNewProPanel(BgPanel,'CardPanel');
  CardPanel.Align = alClient;
  CardPanel.Margins.Left = 20;
  CardPanel.Margins.Right = 20;
  CardPanel.Margins.Top = 10;
  CardPanel.Margins.Bottom = 90; 
  CardPanel.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#121212'); 
  CardPanel.clProSettings.RoundHeight = 20;
  CardPanel.clProSettings.RoundWidth = 20;
  CardPanel.clProSettings.BorderColor = clAlphaColor.clHexToColor('#222222');
  CardPanel.clProSettings.BorderWidth = 1;
  CardPanel.clProSettings.IsFill = True;
  CardPanel.SetclProSettings(CardPanel.clProSettings);
  CardPanel.Visible = False;

  // --- ALT BUTONLAR ---
  ActionButtonPanel = MainForm.AddNewProPanel(BgPanel,'ActionButtonPanel');
  ActionButtonPanel.Align = alBottom;
  ActionButtonPanel.Height = 75;
  ActionButtonPanel.Margins.Left = 20;
  ActionButtonPanel.Margins.Right = 20;
  ActionButtonPanel.Margins.Bottom = 15;
  ActionButtonPanel.Visible = False;

  BtnFav = MainForm.AddNewProButton(ActionButtonPanel,'BtnFav','Listeme Ekle');
  BtnFav.Align = alLeft;
  BtnFav.Width = 130;
  BtnFav.Height = 48;
  BtnFav.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#121212');
  BtnFav.clProSettings.FontColor = clAlphaColor.clWhite;
  BtnFav.clProSettings.FontSize = 13;
  BtnFav.clProSettings.RoundHeight = 14;
  BtnFav.clProSettings.RoundWidth = 14;
  BtnFav.clProSettings.BorderColor = clAlphaColor.clHexToColor('#333333');
  BtnFav.clProSettings.BorderWidth = 1;
  BtnFav.clProSettings.IsFill = True;
  BtnFav.SetclProSettings(BtnFav.clProSettings);
  MainForm.AddNewEvent(BtnFav,tbeOnClick,'AddFavorite');

  BtnNext = MainForm.AddNewProButton(ActionButtonPanel,'BtnNext','BAŞKA BİR TANE 🎲');
  BtnNext.Align = alRight;
  BtnNext.Width = 160;
  BtnNext.Height = 48;
  BtnNext.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#E50914'); 
  BtnNext.clProSettings.FontColor = clAlphaColor.clWhite;
  BtnNext.clProSettings.FontSize = 12;
  BtnNext.clProSettings.TextSettings.Font.Style = [fsBold];
  BtnNext.clProSettings.RoundHeight = 14;
  BtnNext.clProSettings.RoundWidth = 14;
  BtnNext.clProSettings.IsFill = True;
  BtnNext.SetclProSettings(BtnNext.clProSettings);
  MainForm.AddNewEvent(BtnNext,tbeOnClick,'GetMovie');

  MainForm.Run;
}

https://static.cloudflareinsights.com/beacon.min.js/v4513226cdae34746b4dedf0b4dfa099e1781791509496" integrity="sha512-ZE9pZaUXND66v380QUtch/5sE9tPFh2zg45pR2PB0CVkCtOREv2AJKkSidISWkysEuQ0EH8faUU5du78bx87UQ==" 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: 948
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ı: 11 Saat 38 Dakika Önce Saat 10:00
Merhaba Hüseyin, 

 Asenkron çağrılarda Rest.ExecuteAsync event ataması yaparken Rest.OnCompleted = 'ApiCompleted'; şeklinde string bir metin veriyorsun. Ancak derleyicinin asenkron olay yakalama motoru, bu metodu hafızada string ismiyle dinamik ararken tetikleyemez ve API cevabı gelse dahi ApiCompleted prosedürü hiç çalışmaz. Doğru kullanım, event yapısını Atayüz'ün kendi mimarisine emanet ederek doğrudan senkron yürütme Rest.Execute yapmak veya metodu direkt bağlamaktır.



var
  MainForm: TclForm;
  BgPanel, TopPanel, CardPanel, FilterPanel, FavoritesPanel, Top10Panel: TclProPanel;
  ActionButtonPanel: TclProPanel;
  BtnStart, BtnNext, BtnFav, BtnFavorites, BtnTop10: TclProButton;
  MovieImage: TclProImage;
  LblTitle, LblInfo, LblOverview: TclProLabel;
  IntroPanel: TclProPanel;
  IntroTitleLabel, IntroSubLabel: TclProLabel;
  Rest: TclRest;
  SelectedCountry, SelectedGenre, CurrentMovieID: String;
  FavoriteList: TclStringList;
  movieTitle, overview, posterPath, vote, releaseDate, posterUrl: String;
  randomIndex, randomPage: Integer;
  URL, API_KEY, BASE_URL: String;

void ProcessApiResponse;
{
  randomIndex = Random(20);

  CurrentMovieID = Clomosy.CLParseJSON(Rest.Response, 'results.' + IntToStr(randomIndex) + '.id');
  movieTitle = Clomosy.CLParseJSON(Rest.Response, 'results.' + IntToStr(randomIndex) + '.title');
  overview = Clomosy.CLParseJSON(Rest.Response, 'results.' + IntToStr(randomIndex) + '.overview');
  posterPath = Clomosy.CLParseJSON(Rest.Response, 'results.' + IntToStr(randomIndex) + '.poster_path');
  vote = Clomosy.CLParseJSON(Rest.Response, 'results.' + IntToStr(randomIndex) + '.vote_average');
  releaseDate = Clomosy.CLParseJSON(Rest.Response, 'results.' + IntToStr(randomIndex) + '.release_date');

  if (releaseDate <> '')
  {
    releaseDate = Copy(releaseDate, 1, 4);
  }

  LblTitle.Text = movieTitle;
  LblInfo.Text = '⭐ ' + vote + '  |  📅 ' + releaseDate;
  LblOverview.Text = overview;

  if (posterPath <> '')
  {
    posterUrl = 'https://image.tmdb.org/t/p/w500' + posterPath;
    MovieImage.clProSettings.PictureSource = posterUrl;
    MovieImage.SetclProSettings(MovieImage.clProSettings);
  }
}

void GetMovie;
{
  randomPage = Random(10) + 1;
  URL = BASE_URL + '/discover/movie?api_key=' + API_KEY + '&language=tr-TR&sort_by=popularity.desc&page=' + IntToStr(randomPage);

  if (SelectedGenre <> '')
  {
    URL = URL + '&with_genres=' + SelectedGenre;
  }
  if (SelectedCountry <> '')
  {
    URL = URL + '&with_origin_country=' + SelectedCountry;
  }

  try
    Rest = TclRest.Create;
    Rest.Accept = 'application/json';
    Rest.Method = rmGET;
    Rest.BaseURL = URL;
    Rest.Execute;

    if (Rest.Response <> '')
    {
      ProcessApiResponse;
    }
    
    Rest.Free;
  except
    ShowMessage('Film çekme hatası: ' + LastExceptionMessage);
  }
}

void AddFavorite;
var 
  i: Integer;
  Exists: Boolean;
  Item: String;
{
  Exists = False;
  for (i = 0 to FavoriteList.Count - 1)
  {
    Item = Clomosy.StringListItemString(FavoriteList, i);
    if (Pos(CurrentMovieID + '|', Item) == 1)
    {
      Exists = True;
    }
  }

  if (Exists == False)
  {
    FavoriteList.Add(CurrentMovieID + '|' + posterPath + '|' + movieTitle);
    ShowMessage('İzleme listene eklendi! 🍿');
  }
  else
  {
    ShowMessage('Bu film zaten listende var.');
  }
}

void ShowFavorites;
var 
  i: Integer;
  Item, Poster: String;
  Img: TclProImage;
  SplitList: TclStringList;
{
  FavoritesPanel.Visible = True;
  CardPanel.Visible = False;
  FilterPanel.Visible = False;
  ActionButtonPanel.Visible = False;
  Top10Panel.Visible = False;

  FavoritesPanel.DeleteChildren;

  for (i = 0 to FavoriteList.Count - 1)
  {
    Item = Clomosy.StringListItemString(FavoriteList, i);

    SplitList = Clomosy.StringListNew;
    SplitList.StrictDelimiter = True;
    SplitList.Delimiter = '|';
    SplitList.DelimitedText = Item;

    Poster = Clomosy.StringListItemString(SplitList, 1);

    Img = MainForm.AddNewProImage(FavoritesPanel, 'FavImg' + IntToStr(i));
    Img.Align = alTop;
    Img.Height = 240;
    Img.Margins.Top = 15;
    Img.Margins.Left = 30;
    Img.Margins.Right = 30;
    Img.clProSettings.RoundHeight = 16;
    Img.clProSettings.RoundWidth = 16;
    Img.clProSettings.PictureAutoFit = True;
    Img.clProSettings.PictureSource = 'https://image.tmdb.org/t/p/w500' + Poster;
    Img.SetclProSettings(Img.clProSettings);

    SplitList.Free;
  }
}

void ToggleFavorites;
{
  if (FavoritesPanel.Visible == True)
  {
    FavoritesPanel.Visible = False;
    CardPanel.Visible = True;
    FilterPanel.Visible = True;
    ActionButtonPanel.Visible = True;
  }
  else
  {
    ShowFavorites;
  }
}

void ToggleTop10;
var 
  i: Integer;
  poster, title: String;
  FilmPanel: TclProPanel;
  Img: TclProImage;
  Lbl: TclProLabel;
{
  if (Top10Panel.Visible == True)
  {
    Top10Panel.Visible = False;
    CardPanel.Visible = True;
    FilterPanel.Visible = True;
    ActionButtonPanel.Visible = True;
  }
  else
  {
    Top10Panel.Visible = True;
    CardPanel.Visible = False;
    FilterPanel.Visible = False;
    ActionButtonPanel.Visible = False;
    FavoritesPanel.Visible = False;

    Top10Panel.DeleteChildren;

    try
      Rest = TclRest.Create;
      Rest.Accept = 'application/json';
      Rest.Method = rmGET;
      Rest.BaseURL = BASE_URL + '/discover/movie?api_key=' + API_KEY + '&language=tr-TR&sort_by=popularity.desc&page=1';
      Rest.Execute;

      for (i = 0 to 9)
      {
        poster = Clomosy.CLParseJSON(Rest.Response, 'results.' + IntToStr(i) + '.poster_path');
        title = Clomosy.CLParseJSON(Rest.Response, 'results.' + IntToStr(i) + '.title');

        FilmPanel = MainForm.AddNewProPanel(Top10Panel, 'FilmPanel' + IntToStr(i));
        FilmPanel.Align = alLeft;
        FilmPanel.Width = 120;
        FilmPanel.Margins.Left = 2;
        FilmPanel.Margins.Right = 2;

        Img = MainForm.AddNewProImage(FilmPanel, 'TopImg' + IntToStr(i));
        Img.Align = alTop;
        Img.Height = 160;
        Img.clProSettings.PictureAutoFit = True;
        Img.clProSettings.PictureSource = 'https://image.tmdb.org/t/p/w500' + poster;
        Img.SetclProSettings(Img.clProSettings);

        Lbl = MainForm.AddNewProLabel(FilmPanel, 'TopLbl' + IntToStr(i), title);
        Lbl.Align = alBottom;
        Lbl.Height = 40;
        Lbl.clProSettings.FontColor = clAlphaColor.clWhite;
        Lbl.clProSettings.FontSize = 10;
        Lbl.clProSettings.WordWrap = True;
        Lbl.SetclProSettings(Lbl.clProSettings);
      }

      Rest.Free;
    except
      ShowMessage('Top 10 listeleme hatası: ' + LastExceptionMessage);
    }
  }
}

void StartApp;
{
  IntroPanel.Visible = False; 
  CardPanel.Visible = True;
  FilterPanel.Visible = True;
  ActionButtonPanel.Visible = True;
  GetMovie;
}

{
  API_KEY = 'bdadefeeb1178a602f57e923fef4255f';

  SelectedCountry = '';
  SelectedGenre = '';
  FavoriteList = Clomosy.StringListNew;

  MainForm = TclForm.Create(Self);

  BgPanel = MainForm.AddNewProPanel(MainForm, 'BgPanel');
  BgPanel.Align = alClient;
  BgPanel.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#000000'); 
  BgPanel.clProSettings.IsFill = True;
  BgPanel.SetclProSettings(BgPanel.clProSettings);

  TopPanel = MainForm.AddNewProPanel(BgPanel, 'TopPanel');
  TopPanel.Align = alTop;
  TopPanel.Height = 60;
  TopPanel.Margins.Left = 15;
  TopPanel.Margins.Right = 15;

  BtnFavorites = MainForm.AddNewProButton(TopPanel, 'BtnFavorites', 'İzleme Listem 📂');
  BtnFavorites.Align = alRight; BtnFavorites.Width = 130; BtnFavorites.Margins.Top = 12; BtnFavorites.Margins.Bottom = 12;
  BtnFavorites.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#121212');
  BtnFavorites.clProSettings.FontColor = clAlphaColor.clWhite;
  BtnFavorites.clProSettings.FontSize = 11;
  BtnFavorites.clProSettings.RoundHeight = 12; BtnFavorites.clProSettings.RoundWidth = 12;
  BtnFavorites.clProSettings.BorderColor = clAlphaColor.clHexToColor('#333333');
  BtnFavorites.clProSettings.BorderWidth = 1;
  BtnFavorites.clProSettings.IsFill = True;
  BtnFavorites.clProSettings.TextSettings.Font.Style = [fsBold];
  BtnFavorites.SetclProSettings(BtnFavorites.clProSettings);
  MainForm.AddNewEvent(BtnFavorites, tbeOnClick, 'ToggleFavorites');

  BtnTop10 = MainForm.AddNewProButton(TopPanel, 'BtnTop10', 'Top 10 🔥');
  BtnTop10.Align = alRight; BtnTop10.Width = 100; BtnTop10.Margins.Top = 12; BtnTop10.Margins.Bottom = 12;
  BtnTop10.clProSettings = BtnFavorites.clProSettings;
  BtnTop10.SetclProSettings(BtnTop10.clProSettings);
  MainForm.AddNewEvent(BtnTop10, tbeOnClick, 'ToggleTop10');

  IntroPanel = MainForm.AddNewProPanel(BgPanel, 'IntroPanel');
  IntroPanel.Align = alCenter; IntroPanel.Width = 320; IntroPanel.Height = 380;
  IntroPanel.clProSettings.BackgroundColor = clAlphaColor.clNull;
  IntroPanel.clProSettings.IsFill = True;
  IntroPanel.SetclProSettings(IntroPanel.clProSettings);

  IntroTitleLabel = MainForm.AddNewProLabel(IntroPanel, 'IntroTitleLabel', '🍿' + #13#10 + 'Ne' + #13#10 + 'İzlesem?');
  IntroTitleLabel.Align = alTop; IntroTitleLabel.Height = 160;
  IntroTitleLabel.clProSettings.FontColor = clAlphaColor.clHexToColor('#E50914'); 
  IntroTitleLabel.clProSettings.FontSize = 36;
  IntroTitleLabel.clProSettings.TextSettings.Font.Style = [fsBold];
  IntroTitleLabel.clProSettings.TextSettings.HorzAlign = palCenter;
  IntroTitleLabel.SetclProSettings(IntroTitleLabel.clProSettings);

  IntroSubLabel = MainForm.AddNewProLabel(IntroPanel, 'IntroSubLabel', 'Kararsız mısın? Sana en uygun filmi saniyeler içinde bulalım.');
  IntroSubLabel.Align = alTop; IntroSubLabel.Height = 60; IntroSubLabel.Margins.Top = 10;
  IntroSubLabel.clProSettings.FontColor = clAlphaColor.clHexToColor('#8E8E93');
  IntroSubLabel.clProSettings.FontSize = 13;
  IntroSubLabel.clProSettings.WordWrap = True;
  IntroSubLabel.clProSettings.TextSettings.HorzAlign = palCenter;
  IntroSubLabel.SetclProSettings(IntroSubLabel.clProSettings);

  BtnStart = MainForm.AddNewProButton(IntroPanel, 'BtnStart', 'ÖNERİ GETİR ✨');
  BtnStart.Align = alBottom; BtnStart.Height = 50; BtnStart.Margins.Bottom = 10; BtnStart.Margins.Left = 20; BtnStart.Margins.Right = 20;
  BtnStart.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#E50914'); 
  BtnStart.clProSettings.FontColor = clAlphaColor.clWhite;
  BtnStart.clProSettings.FontSize = 14;
  BtnStart.clProSettings.TextSettings.Font.Style = [fsBold];
  BtnStart.clProSettings.RoundHeight = 22; BtnStart.clProSettings.RoundWidth = 22;
  BtnStart.clProSettings.IsFill = True;
  BtnStart.SetclProSettings(BtnStart.clProSettings);
  MainForm.AddNewEvent(BtnStart, tbeOnClick, 'StartApp');

  FilterPanel = MainForm.AddNewProPanel(BgPanel, 'FilterPanel');
  FilterPanel.Align = alTop; FilterPanel.Height = 50; FilterPanel.Margins.Left = 15; FilterPanel.Margins.Right = 15;
  FilterPanel.Visible = False;

  FavoritesPanel = MainForm.AddNewProPanel(BgPanel, 'FavoritesPanel');
  FavoritesPanel.Align = alClient;
  FavoritesPanel.Visible = False;

  Top10Panel = MainForm.AddNewProPanel(BgPanel, 'Top10Panel');
  Top10Panel.Align = alClient;
  Top10Panel.Visible = False;

  CardPanel = MainForm.AddNewProPanel(BgPanel, 'CardPanel');
  CardPanel.Align = alClient;
  CardPanel.Margins.Left = 20; CardPanel.Margins.Right = 20; CardPanel.Margins.Top = 10; CardPanel.Margins.Bottom = 90; 
  CardPanel.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#121212'); 
  CardPanel.clProSettings.RoundHeight = 20; CardPanel.clProSettings.RoundWidth = 20;
  CardPanel.clProSettings.BorderColor = clAlphaColor.clHexToColor('#222222');
  CardPanel.clProSettings.BorderWidth = 1;
  CardPanel.clProSettings.IsFill = True;
  CardPanel.SetclProSettings(CardPanel.clProSettings);
  CardPanel.Visible = False;

  // --- ARALIK KONTROLÜ: API'DEN GELEN GÖRSEL BİLEŞENLERİ ---
  MovieImage = MainForm.AddNewProImage(CardPanel, 'MovieImage');
  MovieImage.Align = alTop; MovieImage.Height = 250; MovieImage.Margins.Top = 10;
  MovieImage.clProSettings.PictureAutoFit = True;
  MovieImage.SetclProSettings(MovieImage.clProSettings);

  LblTitle = MainForm.AddNewProLabel(CardPanel, 'LblTitle', '-');
  LblTitle.Align = alTop; LblTitle.Height = 35; LblTitle.Margins.Left = 15; LblTitle.Margins.Top = 10;
  LblTitle.clProSettings.FontColor = clAlphaColor.clWhite; LblTitle.clProSettings.FontSize = 18; LblTitle.clProSettings.TextSettings.Font.Style = [fsBold];
  LblTitle.SetclProSettings(LblTitle.clProSettings);

  LblInfo = MainForm.AddNewProLabel(CardPanel, 'LblInfo', '-');
  LblInfo.Align = alTop; LblInfo.Height = 25; LblInfo.Margins.Left = 15;
  LblInfo.clProSettings.FontColor = clAlphaColor.clHexToColor('#8E8E93'); LblInfo.clProSettings.FontSize = 12;
  LblInfo.SetclProSettings(LblInfo.clProSettings);

  LblOverview = MainForm.AddNewProLabel(CardPanel, 'LblOverview', '-');
  LblOverview.Align = alClient; LblOverview.Margins.Left = 15; LblOverview.Margins.Right = 15; LblOverview.Margins.Top = 10;
  LblOverview.clProSettings.FontColor = clAlphaColor.clHexToColor('#CBD5E1'); LblOverview.clProSettings.FontSize = 13; LblOverview.clProSettings.TextSettings.WordWrap = True;
  LblOverview.SetclProSettings(LblOverview.clProSettings);

  ActionButtonPanel = MainForm.AddNewProPanel(BgPanel, 'ActionButtonPanel');
  ActionButtonPanel.Align = alBottom; ActionButtonPanel.Height = 75; ActionButtonPanel.Margins.Left = 20; ActionButtonPanel.Margins.Right = 20; ActionButtonPanel.Margins.Bottom = 15;
  ActionButtonPanel.Visible = False;

  BtnFav = MainForm.AddNewProButton(ActionButtonPanel, 'BtnFav', 'Listeme Ekle');
  BtnFav.Align = alLeft; BtnFav.Width = 130; BtnFav.Height = 48;
  BtnFav.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#121212');
  BtnFav.clProSettings.FontColor = clAlphaColor.clWhite;
  BtnFav.clProSettings.FontSize = 13;
  BtnFav.clProSettings.RoundHeight = 14; BtnFav.clProSettings.RoundWidth = 14;
  BtnFav.clProSettings.BorderColor = clAlphaColor.clHexToColor('#333333');
  BtnFav.clProSettings.BorderWidth = 1;
  BtnFav.clProSettings.IsFill = True;
  BtnFav.SetclProSettings(BtnFav.clProSettings);
  MainForm.AddNewEvent(BtnFav, tbeOnClick, 'AddFavorite');

  BtnNext = MainForm.AddNewProButton(ActionButtonPanel, 'BtnNext', 'BAŞKA BİR TANE 🎲');
  BtnNext.Align = alRight; BtnNext.Width = 160; BtnNext.Height = 48;
  BtnNext.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#E50914'); 
  BtnNext.clProSettings.FontColor = clAlphaColor.clWhite;
  BtnNext.clProSettings.FontSize = 12;
  BtnNext.clProSettings.TextSettings.Font.Style = [fsBold];
  BtnNext.clProSettings.RoundHeight = 14; BtnNext.clProSettings.RoundWidth = 14;
  BtnNext.clProSettings.IsFill = True;
  BtnNext.SetclProSettings(BtnNext.clProSettings);
  MainForm.AddNewEvent(BtnNext, tbeOnClick, 'GetMovie');

  MainForm.FormWaiting.Visible = False;
  MainForm.BtnFormMenu.Visible = False;
  MainForm.BtnGoBack.Visible = False;

  MainForm.Run;
}
https://static.cloudflareinsights.com/beacon.min.js/v4513226cdae34746b4dedf0b4dfa099e1781791509496" integrity="sha512-ZE9pZaUXND66v380QUtch/5sE9tPFh2zg45pR2PB0CVkCtOREv2AJKkSidISWkysEuQ0EH8faUU5du78bx87UQ==" 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,031 Saniyede Yüklendi.