Cita:
Empezado por ecfisa
Hola.
Podrías hacer:
Código Delphi [-]
...
var
bt: TBitBtn;
begin
OtroForm := TOtroForm.Create(Self);
OtroForm.Show;
bt := TBitBtn(OtroForm.FindComponent('NombreDelBoton'));
if Assigned(bt) then
bt.Caption := 'New Caption';
...
end;
Saludos
|
Hola Daniel, gracias por contestar.
Ahora q leo tu código ya me da un mejor panorama por donde ir.
Con este código creo los botones...
Código Delphi
[-]
procedure TfrmCambiarMesa.FormShow(Sender: TObject);
var
PosY: Integer;
nLeft:Integer;
begin
Label3.Caption:=frmRegComanda.Edit1.Text;
BitBtn1.Enabled:=False;
qryMesas.Close;
qryMesas.Open;
qryMesas.First;
while ScrollBox1.ControlCount > 0 do
ScrollBox1.Controls[0].Free;
PosY:=8;
nLeft:=8;
n:=1;
if not(qryMesas.IsEmpty) then
begin
While not qryMesas.Eof do
begin
BtnsMesas[n]:=TBitBtn.Create(Self);
with BtnsMesas[n] do
begin
Caption:=qryMesas.FieldByName('MESA_NUM').AsString;
Parent:=ScrollBox1;
Height:=100;
Top:=PosY;
Left:=nLeft;
if nLeft=508 then begin nLeft:=8;
PosY:=PosY+Height+5
end Else Begin
nLeft:=nLeft+100;
end;
Width:=100;
OnClick:=OnButtonClick1;
Font.Size:=12;
Tag:=qryMesas.FieldByName('MESA_NUM').AsInteger;
Font.Style:=[fsBold];
Layout:=blGlyphTop;
Glyph:=Image2.Picture.Bitmap;
end;
qryMesas.Next;
inc(n);
end;
end;
end;
En este codigo no uso la propiedad "Name" del boton, la usaré para crearle un nombre y asi poder acceder a su caption, siguiendo el código q me enviaste.
Lo aplico en cuanto pueda y les comento como me fue.
Saludos y gracias por tu tiempo.