Newsgroups : Borland : borland.public.delphi.rtl.win32 : 2007 Apr : Can't generate event binding in dfm code.

www.cryer.info
Managed Newsgroup Archive

Can't generate event binding in dfm code.

Subject:Can't generate event binding in dfm code.
Posted by:"xy" (..@delphi.com)
Date:Thu, 19 Apr 2007 09:45:59

  object actList: TActionList
    object actOk: TAction
      Caption = 'Ok'
      //OnExecute = actOkExecute //missing ???
    end
  end

  ^^
  ||
    ...
    Form := TForm.Create(nil);
    MyActionList := TActionList.Create(Form);
    with MyActionList do
    begin
      Name := 'actList';
      Action := TAction.Create(nil);
      with Action do
      begin
        Name := 'actOk';
        Caption := 'Ok';
        ActionList := MyActionList;
        OnExecute := Self.actOkExecute;
      end;
    end;
    Result := GetComponent(Form);
    ...

function TDelphiCodeGenerator.GetComponent(AComponent: TComponent):
TStrings;
var
  Stream, ConvStream: TMemoryStream;
begin
  Result := TStringList.Create;
  Stream := TMemoryStream.Create;
  ConvStream := TMemoryStream.Create;
  try
    Stream.WriteComponent(AComponent);
    Stream.Position := 0;
    ObjectBinaryToText(Stream, ConvStream);
    ConvStream.Position := 0;
    Result.LoadFromStream(ConvStream);
  finally
    Stream.Free;
    ConvStream.Free;
  end;
end;

Replies:

www.cryer.info
Managed Newsgroup Archive