24-01-2018, Saat: 12:37
(Son Düzenleme: 24-01-2018, Saat: 12:39, Düzenleyen: TescilsizUzman.)
(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);
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;