Cok sayida label var bunlari dongu icinde etiketlemek istiyorum

Başlatan bunalmis, 17 Haziran 2010, 00:45:57

z

Form uzerine 50 tane label 50 tane de Image nesnesi var.

Bir klasordeki dosyalarin isimlerini ogrenip alfabedik siraya gore labellara tek tek dosya isimlerini yazacagim.
Ayni sekilde image nesnelerine de klasordeki dosyalarin icerigi olan resimleri koyacagim.

Bu islemi de for dongusu ile yapmak istiyorum.

Ancak Labellari ve Image lara nasil parametrik erisecegim bilmiyorum.

Label1.caption:=fname[1];
Label2.caption:=fname[2];
Label3.caption:=fname[3];

seklinde 50 tane satir degilde degilde

for n:=1 to 50 do label[n].caption:=fname[n] seklinde dongu icinde kullanmaya musait olsun istiyorum.

Bana e^st de diyebilirsiniz.   www.cncdesigner.com

SpeedyX

Bence fikir tam oturmamış, dosya sayısı farklı da olabilir, en güzeli label ları dinamik olarak oluşturmak, istersen oluşturduğun label ların bilgilerini bir kenarda saklayıp sonradan değişiklik de yapabilirsin.

procedure TForm1.FormCreate(Sender: TObject);
const
  TheWord = 'deneme';
var
  I: integer;
  NewLabel: TLabel;
begin
  for I := 1 to Length(TheWord) do begin
    NewLabel := TLabel.Create(self);
    NewLabel.Parent := self;
    NewLabel.Top := 20;
    NewLabel.Left := I * 20;
    NewLabel.Caption := TheWord[I];
  end;
end;


for i:=0 to k do begin
with TLabel.Create(Form1 yada self) do begin
Parent := Form1;
Font.size :=16;
Font.Name := 'Arial Bold';
Font.Style := [fsBold];
Alignment := taCenter;
Caption := ' ';
Left := 18+i*30);
Top := 30;
end;
end;

orhanc

evet en güzeli gelecek veri kadar dinamik objeler oluşturmak...
i'm doing nothing... Giddy Up  http://www.drorhan.com

Salih

niye memo nesnesi içinde listelemeyi düşünmüyorsun. Memo nesnesini salt okunur yaparak, bu iş
daha kolay hal olur gibime geliyor.

controller

foreach ile yapabilirsin. mantığını göstermek için c# da form1 deki tüm textbox ları temizleyen bir örnek;

foreach (Control c in Form1.Controls)
                if (c is TextBox)
                    (c as TextBox).Clear();

Hesabım OG tarafından haksız bir şekilde pasif yapılmıştır.

SpeedyX

Yalnız delphi de foreach yok, enum+while yada klasik iterasyon kullanılmalı.

for i := 0 to ComponentCount - 1 do
    if Components[i] is TEdit then TEdit(Components[i]).Text := '';

yada
  for i := 0 to ComponentCount-1 do
      if( Components[ i ] is TEdit )then (Components[ i ] as TEdit).Text := '';

şeklinde yapılıyor.

orhanc

i'm doing nothing... Giddy Up  http://www.drorhan.com

SpeedyX


orhanc

gariptir turbo delphide foreach direk gelirken delphi 2010 da gelmiyor ama kütüphanelerde var sanırım bir sorun var
i'm doing nothing... Giddy Up  http://www.drorhan.com

z

Delphi 6 işimi görüyor diye ileri versiyonları hiç merak etmedim. Delphi 6 da ana programı ve dll programı yazıp ikisini birden debug edemiyorum.

Ya dll ı oluşturup ana programı debug edebiliyorum yada exe programı oluşturup dll i debug ediyorum. Kullandığınız ileri versiyonlar hem dll satırlarını hemde baglı olduğu ana prgramın kod satırlarını debug edebiliyormu?
Bana e^st de diyebilirsiniz.   www.cncdesigner.com

orhanc

Burada nasıl yapıldığını anlatmış

http://delphigeek.blogspot.com/2007/02/debugging-dll-in-delphi.html


***********************************************************
In Delphi 7 you would do this:

Project | Options | Compiler | Debugging | Debug information (check)

Then go to Run | Parameters | Host Application and enter the name of your exe.

Add some breakpoints in your DLL code and then click run. Your exe will be loaded and you can debug the DLL parts in the Delphi IDE.

If your exe is already running, click Run | Attach to process

-- I've tested this and found that I also needed to check the "Include remote debug symbols" on the Linker page of project options in Delphi 7.

I was able to get a breakpoint to hit using the Run | Parameters as well as Run | Attach to process methods. The test DLL I had created had a single stdcall function and was dynamically loaded by a Visual C++ console application.
i'm doing nothing... Giddy Up  http://www.drorhan.com

sekoli

@bunalmis hocam selamlar. Delphi 6' da aynı anda hem host application 'ı hemde dll' i debug edebilirsiniz. İki adet delphi 6 açmanız yeterli.
İyi çalışmalar.

z

Yanlis anlama yok degilmi, ben hem Ana programi hem de ana programin kullandigi dll i ayni zamanda debug etmek istiyorum.

Ornegin ana uygulamayi adim adim yurutup dll deki bir fonksiyonun  cagrildigi yere geldim. Adim at dedigimde  dll icindeki ilgili
fonskyona koydugum break pointden  dolayi bu kez dll de adim adim yurutme islemi yapabilmeliyim.


Bana e^st de diyebilirsiniz.   www.cncdesigner.com

orhanc

i'm doing nothing... Giddy Up  http://www.drorhan.com

z

Alıntı yapılan: sekoli - 18 Haziran 2010, 13:01:14
@bunalmis hocam selamlar. Delphi 6' da aynı anda hem host application 'ı hemde dll' i debug edebilirsiniz. İki adet delphi 6 açmanız yeterli.
İyi çalışmalar.

Sekoli nasil olacak bu is?
Bana e^st de diyebilirsiniz.   www.cncdesigner.com