Einzelnen Beitrag anzeigen

miLeRiAm

Registriert seit: 3. Sep 2004
Ort: :/root
34 Beiträge
 
RAD-Studio 2009 Pro
 
#10

Re: Anzahl Formulare in der Applikation

  Alt 31. Okt 2008, 11:10
Zitat von Frankfurtoder:
Formatieren hilft Der Code mit den If's sieht ja grausam aus.
Delphi-Quellcode:
 if handleList.Count = 0 then
 begin

  frmMain.handleList.Clear;

  for j := 0 to screen.FormCount-1 do
  begin

   for i := 0 to screen.Forms[j].ComponentCount-1 do
   begin
    screen.Forms[j].Components[i].Tag := ((j+1) * 10000) + i;
   end;

   for i := 0 to screen.Forms[j].ComponentCount-1 do
   begin

    comp := screen.Forms[j].Components[i];

    if (comp is TButton) or (comp is TToolButton) or (comp is TLabel) or (comp is TMenuItem) or
       (comp is TCheckBox) or (comp is TRadioButton) or (comp is TTabSheet) or (comp is TSpeedButton)
    then
     begin

      if comp is TButton then handleList.Add(IntToStr(comp.Tag)+'='+TButton(comp).Caption);
      if comp is TToolButton then handleList.Add(IntToStr(comp.Tag)+'='+TToolButton(comp).Caption);
      if comp is TLabel then handleList.Add(IntToStr(comp.Tag)+'='+TLabel(comp).Caption);
      if comp is TMenuItem then handleList.Add(IntToStr(comp.Tag)+'='+TMenuItem(comp).Caption);
      if comp is TCheckBox then handleList.Add(IntToStr(comp.Tag)+'='+TCheckBox(comp).Caption);
      if comp is TRadioButton then handleList.Add(IntToStr(comp.Tag)+'='+TRadioButton(comp).Caption);
      if comp is TTabSheet then handleList.Add(IntToStr(comp.Tag)+'='+TTabSheet(comp).Caption);
      if comp is TSpeedButton then handleList.Add(IntToStr(comp.Tag)+'='+TSpeedButton(comp).Caption);

     end;

   end;

  end;

 end;

Habe ich grade
Wurde langsam wirklich unübersichtlich.

Gefallen tut mir die Lösung aber dennoch nicht.

Stichwort: Mehrsprachigkeit.
  Mit Zitat antworten Zitat