Hola que tal.
tengo la necesidad de convertir en Run Time el texto de la estructura de un TForm con sus componentes visuales, no visuales y sus eventos a partir de texto como este
el cual es la estructura de un TForm con un TEdit y un TTable
delphi
object fforma: TForm Left = 1162 Top = 216 Caption = 'Hola' ClientHeight = 462 ClientWidth = 484 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] OldCreateOrder = False Position = poDesigned Visible = True PixelsPerInch = 96 TextHeight = 13 object editx: TEdit Left = 20 Top = 50 Width = 150 Height = 21 TabOrder = 0 Text = 'editx' end object tabla: TTable end end
Este texto lo obtengo con esta función
delphi
function ComponentToStringProc(sComponent: string): string; var BinStream:TMemoryStream; StrStream: TStringStream; s: string; sForm:TForm; begin sform:=Tform(FindComponent(sComponent)); if sForm<> nil then begin BinStream := TMemoryStream.Create; try StrStream := TStringStream.Create(s); try BinStream.WriteComponent(sform); BinStream.Seek(0, soFromBeginning); ObjectBinaryToText(BinStream, StrStream); StrStream.Seek(0, soFromBeginning); Result:= StrStream.DataString; finally StrStream.Free; end; finally BinStream.Free end; end;
Tendrán alguna sugerencia de como lograr esto?
Muchas Gracias por anticipado.
Saludos desde México