Konuyu Oyla:
  • Derecelendirme: 0/5 - 0 oy
  • 1
  • 2
  • 3
  • 4
  • 5
Resim Silme
#11
(22-01-2018, Saat: 21:46)Paranoyaq Adlı Kullanıcıdan Alıntı: Hocam kodu şu şekilde düzenledim , 
var
sfile:string;
begin
MessageDlg('Kaydedilen Resim silinsin mi?', System.UITypes.TMsgDlgType.mtInformation,
 [
    System.UITypes.TMsgDlgBtn.mbYes,
    System.UITypes.TMsgDlgBtn.mbNo

  ], 0,
   procedure(const AResult: System.UITypes.TModalResult)
   begin
     case AResult of
      mrYES:
    begin
     if ListView1.ItemIndex > -1 then
       begin
         //sfile := TPath.Combine(TPath.GetDocumentsPath(), ListView1.Items[ListView1.Selected.Index].Text); //ListView Text'inde dosya adı olduğunu varsayıyorum.
      sfile:= System.IOUtils.TPath.Combine(System.IOUtils.TPath.GetSharedPicturesPath() ,Listview1.Items[Listview1.Selected].Text);
       if fileexists(sfile) then
         begin
            deletefile(sfile);
            ListView1.Items.Delete(ListView1.Selected.Index);
            showmessage('Dosyaları yenileyin');
         end
          else
           showmessage('Dosya bulunamadı');
       end
         else
          showmessage('Listeden bir kayıt seçmelisiniz');
     end;
     mrNo:
    showmessage('Dosya silme işlemi iptal edildi');
    end;
   end);
Aşağıdaki kodu kullanınca TPath does not contain a member named 'Combine' at line ... ve TPath does not contain a member named 'GetDocumentsPath' at line  hatası veriyor
         sfile := TPath.Combine(TPath.GetDocumentsPath(), ListView1.Items[ListView1.Selected.Index].Text); //ListView Text'inde dosya adı olduğunu varsayıyorum.
Aşağıdaki kodda ise  resimdeki uyarıları veriyor
      sfile:= System.IOUtils.TPath.Combine(System.IOUtils.TPath.GetSharedPicturesPath() ,Listview1.Items[Listview1.Selected].Text);

Ads_z.png

Merhaba,
Kodunuzda meydana gelen tip dönüşüm hataları ve Uses bildirimleri tamamen ObJect Pascal temel kavramlar konusu ile ilgilidir.
Bu konularda biraz daha araştırma ve çaba göstermenizi rica ediyorum.
Çalışan kod yapısı aşağıdaki gibidir; kendi kodunuz ile karşılaştırıp bir değerlendirme yaparsanız, bu tip muhtemel hataların önüne geçmiş olursunuz. 
procedure Tdrawmaindemo1frm.SpeedButton2Click(Sender: TObject);
var
 sfile: string;
begin
 TDialogService.MessageDialog('Kaydı silmek istediğinize emin misiniz?',
   TMsgDlgType.mtConfirmation, FMX.Dialogs.mbYesNo, TMsgDlgBtn.mbNo, 0,
   procedure(const AResult: TModalResult)
   begin
     case AResult of
       mrYes:
         begin

           if ListView1.ItemIndex > -1 then
           begin
             // sfile := TPath.Combine(TPath.GetDocumentsPath(), ListView1.Items[ListView1.Selected.Index].Text); //ListView Text'inde dosya adı olduğunu varsayıyorum.
             sfile := System.IOUtils.TPath.Combine
               (System.IOUtils.TPath.GetSharedPicturesPath(),
               ListView1.Items[ListView1.Selected.Index].Text);
             if fileexists(sfile) then
             begin
               try
                 deletefile(sfile);
                 ListView1.Items.Delete(ListView1.Selected.Index);
                 // Kayıt Silme kodlarınız
                 ShowMessage('Kayıt silindi!');
               except
                 ShowMessage('Bir hatadan dolayı silme işlemi iptal edildi!');
               end;
             end;
           end;
         end;
       mrNo:
         ShowMessage('Kayıt silme işlemi iptal edildi!');

     end
   end);
end;
Cevapla


Konu ile Alakalı Benzer Konular
Konular Yazar Yorumlar Okunma Son Yorum
  [Çözüldü] FMX Android uygulaması ile sunucuya resim yükleme Mesut 2 491 25-07-2023, Saat: 00:40
Son Yorum: Mesut
  Galerinden resim eklediğim zaman yönünün değişmesi codder71 4 829 24-07-2023, Saat: 18:32
Son Yorum: codder71
  Resim Çizme Programı quiet1day 0 289 24-07-2023, Saat: 11:35
Son Yorum: quiet1day
  IOS galeriden resim veya video seçme hakkında Mr.X 6 1.103 11-05-2023, Saat: 06:54
Son Yorum: emozgun
  Klasör silme Husv 6 1.266 03-03-2023, Saat: 12:54
Son Yorum: sabanakman



Konuyu Okuyanlar: 1 Ziyaretçi