delphi4arab منتديات دلفي للعرب
نقل السطر المحدد منlistbox1 الىlistbox2 - نسخة قابلة للطباعة

+- delphi4arab منتديات دلفي للعرب (https://delphi4arab.net/forum)
+-- قسم : منتديات دلفي للعرب التعليمية (https://delphi4arab.net/forum/forumdisplay.php?fid=3)
+--- قسم : سؤال و جواب حول دلفي (https://delphi4arab.net/forum/forumdisplay.php?fid=15)
+--- الموضوع : نقل السطر المحدد منlistbox1 الىlistbox2 (/showthread.php?tid=3535)



نقل السطر المحدد منlistbox1 الىlistbox2 - لؤي - 26-10-2011

سلام الله عليكم

لدي إثنان listbox يحتوي الملف 'Fichier1.txt' على اسطر ...ماهي التعليمة اللازمة التي اضعها حتى يتسنى لي نقل السطر المحدد من listbox1 الى listbox2


PHP كود :
procedure TForm1.FormCreate(Sender: TObject);
begin
listbox1
.Items.LoadFromFile(ExtractFilePath(Application.ExeName)+'Fichier1.txt');
end; 



نقل السطر المحدد منlistbox1 الىlistbox2 - محمد عبد العزيز - 26-10-2011

وعليكم السلام ورحمة الله

جرب شئ مثل:
كود :
if ListBox1.itemindex<>-1 then ListBox2.Items.Add(ListBox1.Items[ListBox1.ItemIndex]);



نقل السطر المحدد منlistbox1 الىlistbox2 - لؤي - 26-10-2011

بارك الله فيك كنت أبحث عن النواة التي أدرجتها و بها أستخرجت :
كود :
procedure TForm1.Button1Click(Sender: TObject); begin if ListBox1.itemindex<>-1 then ListBox2.Items.Add(ListBox1.Items[ListBox1.ItemIndex]); end; procedure TForm1.FormCreate(Sender: TObject); begin listbox1.Items.LoadFromFile(ExtractFilePath(Application.ExeName)+'Fichier1.txt'); end; procedure TForm1.ListBox1DblClick(Sender: TObject); begin if ListBox1.itemindex<>-1 then begin ListBox2.Items.Add(ListBox1.Items[ListBox1.ItemIndex]); ListBox1.Items.Delete(ListBox1.ItemIndex); end; end; procedure TForm1.ListBox2DblClick(Sender: TObject); begin if ListBox2.itemindex<>-1 then begin ListBox1.Items.Add(ListBox2.Items[ListBox2.ItemIndex]); ListBox2.Items.Delete(ListBox2.ItemIndex); end; end;
أي يمكن التنقل من المكونين بـdouble click