Hola.
Sinceramente no sé si entendí bién la situación...
Pero a ver, si el problema radica aquí
Código Delphi
[-]
procedure TForm1.Btn_TemaClick( Sender: TObject);
begin
With Sender as TButton do begin
Caption := 'Primer Item';
end;
end;
entonces el caso es que:
Edt_Tema de tipo
TEdit y
CBox de tipo
TComboBox son variables locales del método
Button1Click y para usarlas desde el método
Btn_Tema podrías:
- Declararlas como privadas de TForm1.
- Declararlas globales a la implementación.
- Darle un nombre en la creación y luego buscarlas con el método FindComponent.
Ejemplos con cada uno de los modos:
1.
Código Delphi
[-]
...
procedure TForm1.Btn_TemaClick( Sender: TObject);
begin
FEdt_Tema.Text := FCBox.Items[FCBox.ItemIndex];
2.
Código Delphi
[-]
...
implementation
var
GEdt: TEdit;
GCBox: TComboBox;
procedure TForm1.Btn_TemaClick( Sender: TObject);
begin
GEdt_Tema.Text := GCBox.Items[GCBox.ItemIndex];
3.
Código Delphi
[-]
...
procedure TForm1.Btn_TemaClick(Sender: TObject);
var
C1, C2: TComponent;
begin
C1 := FindComponent('Edt_Tema');
C2 := FindComponent('CBox');
if Assigned(C1)and Assigned(C2) then
TEdit(C1).Text := TComboBox(C2).Items[TComboBox(C2).ItemIndex];
end;
procedure TForm1.Button1Click(Sender: TObject);
var
Btn_Tema: TButton;
Edt_Tema: TEdit;
CBox: TComboBox;
begin
Edt_Tema := TEdit.Create(Self);
Edt_Tema.Parent := Self;
Edt_Tema.Name := 'Edt_Tema';
Edt_Tema.Top := 5;
CBox := TComboBox.Create(Self);
CBox.Parent := Self;
CBox.Name := 'CBox';
CBox.Items.Add('uno');
CBox.Items.Add('dos');
CBox.Items.Add('tres');
CBox.Top := 50;
Btn_Tema := TButton.Create(Self);
Btn_Tema.Parent := Self;
Btn_Tema.Name := 'Btn_Tema';
Btn_Tema.Top := 100;
Btn_Tema.OnClick := Btn_TemaClick;
end;
Saludos