Bueno, estan lo que seria array de procedure of object...
Código Delphi
[-]
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
procedure Funcion_1;
procedure Funcion_2;
procedure Funcion_3;
procedure Funcion_4;
procedure Funcion_5;
procedure FormActivate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
public
funciones : array [1..5] of procedure of object;
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.FormActivate(Sender: TObject);
begin
Funciones[1] := Funcion_1;
Funciones[2] := Funcion_2;
Funciones[3] := Funcion_3;
Funciones[4] := Funcion_4;
Funciones[5] := Funcion_5;
end;
procedure TForm1.Funcion_1;
begin
ShowMessage('funcion 1');
end;
procedure TForm1.Funcion_2;
begin
ShowMessage('funcion 2');
end;
procedure TForm1.Funcion_3;
begin
ShowMessage('funcion 3');
end;
procedure TForm1.Funcion_4;
begin
ShowMessage('funcion 4');
end;
procedure TForm1.Funcion_5;
var
i : integer;
begin
ShowMessage('Funcion 5 : todas');
for i := 1 to 4 do
begin
Funciones[i];
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
s : string;
begin
s := (sender as TControl).Name;
Funciones[strtoint(stringreplace(s,'Button','',[rfReplaceAll,rfIgnoreCase]))];
end;
end.
tiene 5 buttons los cinco asignados el onbuttonclick a Button1Click; (los nombres tienen q ser Button1,Button2, etc...)
en tu caso seria usar
Código Delphi
[-]
procedure TForm1.Button1Click(Sender: TObject);
begin
Funciones[ComboBox1.ItemIndex];
end;
saludos