Sayfayı Yazdır | Pencereyi Kapat

olmayan satır hatası

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=1175
Tarih: 11 Ağustos 2025 Saat 23:15
Program Versiyonu: Web Wiz Forums 12.07 - https://www.webwizforums.com


Konu: olmayan satır hatası
Mesajı Yazan: kübra
Konu: olmayan satır hatası
Mesaj Tarihi: 11 Ağustos 2025 Saat 18:05
kodum aşagıdaki gibi her çalıştırmayı denediğimde olmayan satırda hata veriyor yanı 321 satır varsa 322 de hata veriyor. Bilgisi olan birisi yardımcı olabilirse çok sevinirim.
var
  // FORM & PANELS
  DashForm: TclForm;
  HeaderPanel, MenuPanel, SideMenuPanel, WeatherPanel: TclProPanel;

  // LABELS & BUTTONS & IMAGE
  NameLbl, PlateLbl: TclProLabel;
  MapBtn: TclProButton;
  MenuBtn, SideProfileBtn, SideVehicleInfoBtn, SideLogoutBtn: TclProButton;

  // Weather UI
  WeatherCityLbl, WeatherCountryLbl, WeatherTempLbl, WeatherDescLbl, WeatherHumLbl: TclProLabel;
  WeatherIcon: TclProImage;
  RefreshWeatherBtn: TclProButton;

  // COLORS
  BtnBGColor, BtnFontColor: TAlphaColor;

  // USER
  currentUser, userPlate: String;

  // WEATHER REQUEST
  Http: TclHttp;
  WeatherLink, WeatherJSON: String;
  WCity, WCountry, WTempC, WDesc, WHum, WIconPath: String;

void LogoutBtnClick;
{
  Clomosy.RunUnit('Login');
  DashForm.Close;
}

void MenuBtnClick;
{
  if SideMenuPanel.Visible
  {
    SideMenuPanel.Visible = False;
  }
  else
  {
    SideMenuPanel.Visible = True;
  }
  SideMenuPanel.BringToFront;
}

void MapBtnClick;
{
  Clomosy.RunUnit('Map');
  DashForm.Close;
}

void GoToProfileUnit;
{
  Clomosy.RunUnit('Profile');
  DashForm.Close;
}

void GoToVehicleInfoUnit;
{
  Clomosy.RunUnit('VehicleInfo');
}

void LoadWeather;
{
  try
  {
    WeatherLink = ' http://api.weatherapi.com/v1/current.json?key=1ac75bb0af5d498e829125345251108&q=auto:ip&aqi=no" rel="nofollow - http://api.weatherapi.com/v1/current.json?key=1ac75bb0af5d498e829125345251108&q=auto:ip&aqi=no ';

    if not Assigned(Http)
    {
      Http = TclHttp.Create(Nil);
    }

    WeatherJSON = Http.GetRequest(WeatherLink);

    WCity     = Clomosy.CLParseJSON(WeatherJSON, 'location.name');
    WCountry  = Clomosy.CLParseJSON(WeatherJSON, 'location.country');
    WTempC    = Clomosy.CLParseJSON(WeatherJSON, 'current.temp_c');
    WDesc     = Clomosy.CLParseJSON(WeatherJSON, 'current.condition.text');
    WHum      = Clomosy.CLParseJSON(WeatherJSON, 'current.humidity');
    WIconPath = Clomosy.CLParseJSON(WeatherJSON, 'current.condition.icon'); // //cdn...

    WeatherCityLbl.Text    = WCity;
    WeatherCountryLbl.Text = WCountry;
    WeatherTempLbl.Text    = WTempC + '°C';
    WeatherDescLbl.Text    = WDesc;
    WeatherHumLbl.Text     = 'Nem: ' + WHum + '%';

    if Length(WIconPath) > 0
    {
      if Pos('http', WIconPath) == 0
      {
        WIconPath = 'https:' + WIconPath;
      }
      DashForm.SetImage(WeatherIcon, WIconPath);
    }
  }
  except
  {
    ShowMessage('Hava durumu alınamadı: ' + LastExceptionMessage);
  }


 // ==== MAIN BLOCK (TEK) ====

  // ----- USER BİLGİSİ -----
  try
  {
    currentUser = Trim(Clomosy.GlobalVariableString);
    if Pos('|', currentUser) > 0
    {
      userPlate = Copy(currentUser, Pos('|', currentUser) + 1, Length(currentUser));
      currentUser = Copy(currentUser, 1, Pos('|', currentUser) - 1);
    }
    else
    {
      userPlate = 'PLAKA YOK';
      currentUser = 'Misafir';
    }
  }
  except
    currentUser = 'Misafir';
    userPlate = 'PLAKA YOK';
  // ----- RENKLER -----
  BtnBGColor  = clAlphaColor.clHexToColor('#32A690');
  BtnFontColor = clAlphaColor.clHexToColor('#fcfafa');
  
  }
  }

{  // ----- FORM -----
  DashForm = TclForm.Create(Self);
  DashForm.SetFormBGImage(' https://resmim.net/cdn/2025/08/08/XiDt1R.png" rel="nofollow - https://resmim.net/cdn/2025/08/08/XiDt1R.png ');

  // ----- HEADER -----
  HeaderPanel = DashForm.AddNewProPanel(DashForm, 'HeaderPanel');
  HeaderPanel.Align = alTop;
  HeaderPanel.Height = 100;
  HeaderPanel.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#ffffff');
  HeaderPanel.SetclProSettings(HeaderPanel.clProSettings);

  MenuBtn = DashForm.AddNewProButton(HeaderPanel, 'MenuBtn', '');
  MenuBtn.Align = alLeft;
  MenuBtn.Width = 40;
  MenuBtn.Height = 40;
  MenuBtn.Margins.Left = 10;
  MenuBtn.Margins.Top = 10;
  MenuBtn.clProSettings.FontColor = clAlphaColor.clHexToColor('#32A690');
  MenuBtn.SetclProSettings(MenuBtn.clProSettings);
  DashForm.SetImage(MenuBtn, ' https://resmim.net/cdn/2025/08/05/X0aIV3.png" rel="nofollow - https://resmim.net/cdn/2025/08/05/X0aIV3.png ');
  DashForm.AddNewEvent(MenuBtn, tbeOnClick, 'MenuBtnClick');

  NameLbl = DashForm.AddNewProLabel(HeaderPanel, 'NameLbl', currentUser);
  NameLbl.Align = alNone;
  NameLbl.Width = 140;
  NameLbl.Top = 40;
  NameLbl.Left = 90;
  NameLbl.clProSettings.FontColor = clAlphaColor.clHexToColor('#32A690');
  NameLbl.clProSettings.FontSize = 18;
  NameLbl.SetclProSettings(NameLbl.clProSettings);

  PlateLbl = DashForm.AddNewProLabel(HeaderPanel, 'PlateLbl', userPlate);
  PlateLbl.Align = alNone;
  PlateLbl.Width = 130;
  PlateLbl.Top = 40;
  PlateLbl.Left = 240;
  PlateLbl.clProSettings = NameLbl.clProSettings;
  PlateLbl.SetclProSettings(PlateLbl.clProSettings);

  // ----- SIDE MENU -----
  SideMenuPanel = DashForm.AddNewProPanel(DashForm, 'SideMenuPanel');
  SideMenuPanel.Align = alNone;
  SideMenuPanel.Left = 0;
  SideMenuPanel.Top = 115;
  SideMenuPanel.Width = 200;
  SideMenuPanel.Height = 220;
  SideMenuPanel.Visible = False;
  SideMenuPanel.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#fcfafa');
  SideMenuPanel.clProSettings.RoundWidth = 30;
  SideMenuPanel.clProSettings.RoundHeight = 30;
  SideMenuPanel.SetclProSettings(SideMenuPanel.clProSettings);

  SideProfileBtn = DashForm.AddNewProButton(SideMenuPanel, 'SideProfileBtn', 'Profil');
  SideProfileBtn.Align = alTop;
  SideProfileBtn.Height = 50;
  SideProfileBtn.Margins.Top = 20;
  SideProfileBtn.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#1fde52');
  SideProfileBtn.clProSettings.FontColor = BtnFontColor;
  SideProfileBtn.clProSettings.RoundWidth = 20;
  SideProfileBtn.clProSettings.RoundHeight = 20;
  SideProfileBtn.SetclProSettings(SideProfileBtn.clProSettings);
  DashForm.AddNewEvent(SideProfileBtn, tbeOnClick, 'GoToProfileUnit');

  SideVehicleInfoBtn = DashForm.AddNewProButton(SideMenuPanel, 'SideVehicleInfoBtn', 'Araç Bilgileri');
  SideVehicleInfoBtn.Align = alTop;
  SideVehicleInfoBtn.Height = 50;
  SideVehicleInfoBtn.Margins.Top = 15;
  SideVehicleInfoBtn.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#1fde52');
  SideVehicleInfoBtn.clProSettings.FontColor = BtnFontColor;
  SideVehicleInfoBtn.clProSettings.RoundWidth = 20;
  SideVehicleInfoBtn.clProSettings.RoundHeight = 20;
  SideVehicleInfoBtn.SetclProSettings(SideVehicleInfoBtn.clProSettings);
  DashForm.AddNewEvent(SideVehicleInfoBtn, tbeOnClick, 'GoToVehicleInfoUnit');

  SideLogoutBtn = DashForm.AddNewProButton(SideMenuPanel, 'SideLogoutBtn', 'Çıkış Yap');
  SideLogoutBtn.Align = alTop;
  SideLogoutBtn.Height = 50;
  SideLogoutBtn.Margins.Top = 15;
  SideLogoutBtn.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#EF4444');
  SideLogoutBtn.clProSettings.FontColor = clAlphaColor.clHexToColor('#FFFFFF');
  SideLogoutBtn.clProSettings.RoundWidth = 20;
  SideLogoutBtn.clProSettings.RoundHeight = 20;
  SideLogoutBtn.SetclProSettings(SideLogoutBtn.clProSettings);
  DashForm.AddNewEvent(SideLogoutBtn, tbeOnClick, 'LogoutBtnClick');

  // ----- WEATHER PANEL (HEADER ALTINDA) -----
  WeatherPanel = DashForm.AddNewProPanel(DashForm, 'WeatherPanel');
  WeatherPanel.Align = alTop;
  WeatherPanel.Height = 120;
  WeatherPanel.Margins.Left = 20;
  WeatherPanel.Margins.Right = 20;
  WeatherPanel.Margins.Top = 10;
  WeatherPanel.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#ffffffB3');
  WeatherPanel.clProSettings.RoundWidth = 20;
  WeatherPanel.clProSettings.RoundHeight = 20;
  WeatherPanel.SetclProSettings(WeatherPanel.clProSettings);

  WeatherIcon = DashForm.AddNewProImage(WeatherPanel, 'WeatherIcon');
  WeatherIcon.Align = alLeft;
  WeatherIcon.Width = 64;
  WeatherIcon.Height = 64;
  WeatherIcon.Margins.Left = 14;
  WeatherIcon.Margins.Top = 14;

  WeatherCityLbl = DashForm.AddNewProLabel(WeatherPanel, 'WeatherCityLbl', '');
  WeatherCityLbl.Align = alNone;
  WeatherCityLbl.Left = 94;
  WeatherCityLbl.Top = 16;
  WeatherCityLbl.clProSettings.FontSize = 18;
  WeatherCityLbl.clProSettings.FontColor = clAlphaColor.clHexToColor('#32A690');
  WeatherCityLbl.clProSettings.TextSettings.Font.Style = [fsBold];
  WeatherCityLbl.SetclProSettings(WeatherCityLbl.clProSettings);

  WeatherCountryLbl = DashForm.AddNewProLabel(WeatherPanel, 'WeatherCountryLbl', '');
  WeatherCountryLbl.Align = alNone;
  WeatherCountryLbl.Left = 94;
  WeatherCountryLbl.Top = 44;
  WeatherCountryLbl.clProSettings.FontSize = 14;
  WeatherCountryLbl.clProSettings.FontColor = clAlphaColor.clHexToColor('#32A690');
  WeatherCountryLbl.SetclProSettings(WeatherCountryLbl.clProSettings);

  WeatherTempLbl = DashForm.AddNewProLabel(WeatherPanel, 'WeatherTempLbl', '');
  WeatherTempLbl.Align = alNone;
  WeatherTempLbl.Left = 260;
  WeatherTempLbl.Top = 16;
  WeatherTempLbl.clProSettings.FontSize = 26;
  WeatherTempLbl.clProSettings.FontColor = clAlphaColor.clHexToColor('#000000');
  WeatherTempLbl.clProSettings.TextSettings.Font.Style = [fsBold];
  WeatherTempLbl.SetclProSettings(WeatherTempLbl.clProSettings);

  WeatherDescLbl = DashForm.AddNewProLabel(WeatherPanel, 'WeatherDescLbl', '');
  WeatherDescLbl.Align = alNone;
  WeatherDescLbl.Left = 94;
  WeatherDescLbl.Top = 70;
  WeatherDescLbl.clProSettings.FontSize = 14;
  WeatherDescLbl.clProSettings.FontColor = clAlphaColor.clHexToColor('#000000');
  WeatherDescLbl.SetclProSettings(WeatherDescLbl.clProSettings);

  WeatherHumLbl = DashForm.AddNewProLabel(WeatherPanel, 'WeatherHumLbl', '');
  WeatherHumLbl.Align = alNone;
  WeatherHumLbl.Left = 260;
  WeatherHumLbl.Top = 60;
  WeatherHumLbl.clProSettings.FontSize = 14;
  WeatherHumLbl.clProSettings.FontColor = clAlphaColor.clHexToColor('#000000');
  WeatherHumLbl.SetclProSettings(WeatherHumLbl.clProSettings);

  RefreshWeatherBtn = DashForm.AddNewProButton(WeatherPanel, 'RefreshWeatherBtn', 'Yenile');
  RefreshWeatherBtn.Align = alRight;
  RefreshWeatherBtn.Width = 80;
  RefreshWeatherBtn.Margins.Right = 10;
  RefreshWeatherBtn.Margins.Top = 10;
  RefreshWeatherBtn.clProSettings.BackgroundColor = BtnBGColor;
  RefreshWeatherBtn.clProSettings.FontColor = BtnFontColor;
  RefreshWeatherBtn.clProSettings.RoundWidth = 14;
  RefreshWeatherBtn.clProSettings.RoundHeight = 14;
  RefreshWeatherBtn.SetclProSettings(RefreshWeatherBtn.clProSettings);
  DashForm.AddNewEvent(RefreshWeatherBtn, tbeOnClick, 'LoadWeather'); // doğrudan LoadWeather

  // ----- MENÜ (alClient) -----
  MenuPanel = DashForm.AddNewProPanel(DashForm, 'MenuPanel');
  MenuPanel.Align = alClient;
  MenuPanel.Margins.Top = 10;
  MenuPanel.Margins.Left = 30;
  MenuPanel.Margins.Right = 30;
  MenuPanel.clProSettings.RoundWidth = 40;
  MenuPanel.clProSettings.RoundHeight = 40;
  MenuPanel.SetclProSettings(MenuPanel.clProSettings);

  MapBtn = DashForm.AddNewProButton(MenuPanel, 'MapBtn', 'Haritada Görüntüle');
  MapBtn.Align = alNone;
  MapBtn.Height = 50;
  MapBtn.Width = MenuPanel.Width * 70 / 100;
  MapBtn.Top = MenuPanel.Height - 115;
  MapBtn.Left = (MenuPanel.Width - MapBtn.Width) / 2;
  MapBtn.Margins.Bottom = 85;
  MapBtn.clProSettings.BackgroundColor = BtnBGColor;
  MapBtn.clProSettings.RoundHeight = 20;
  MapBtn.clProSettings.RoundWidth = 20;
  MapBtn.clProSettings.BorderColor = clAlphaColor.clHexToColor('#fcfafa');
  MapBtn.clProSettings.FontColor = BtnFontColor;
  MapBtn.clProSettings.FontSize = 16;
  MapBtn.clProSettings.BorderWidth = 2;
  MapBtn.SetclProSettings(MapBtn.clProSettings);
  DashForm.AddNewEvent(MapBtn, tbeOnClick, 'MapBtnClick');

  // İlk açılışta hava durumu yükle
  LoadWeather;

  DashForm.Run;

} // ==== MAIN BLOCK END ====



-------------
kkk



Cevaplar:
Mesajı Yazan: cerenn
Mesaj Tarihi: 11 Ağustos 2025 Saat 18:29
Merhaba Kübra
Bazen parantez kullanımları yanlış olduğunda bu tip hatalar alabiliyoruz.Try-except kullanırken yanlışlık yaptığını görüyorum.
https://clomosy.com/docs/ClomosyKitapV2.pdf" rel="nofollow - https://clomosy.com/docs/ClomosyKitapV2.pdf bu kitaptan sayfa 36 try-except kullanımını inceleyebilirmisin genel şablon şu şekilde olmalı
try 
//Hata yoksa bu bölümde bulunan kod satırları çalışır 
except 
//hata olması durumda bu bölümde bulunan kod satırları çalışır 
try kısmında parantez atmayıp except dedikten sonra olmayan parantezi kapatır gibi fazladan parantez atarız.

Ayrıca  if kullanırken mesela if not Assigned(Http) şeklinde değilde    if (not Assigned(Http)) şeklinde kullanırsan daha iyi olur bazen bu kısımlarda da hata verebiliyor.
Tüm bunları yaptıktan sonra hala hata verirse,yeni bir proje oluşturup kodlarını oraya yapıştırıp dener misin?Bazen böyle sorunlar olabiliyor.
İyi çalışmalar



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