Search code examples
delphiindy

How to declare an object in the "Mastering delphi" book


Im learning delphi through books and am encountering a problem in this chapter: http://etutorials.org/Programming/mastering+delphi+7/Part+IV+Delphi+the+Internet+and+a+.NET+Preview/Chapter+19+Internet+Programming+Sockets+and+Indy/Building+Socket+Applications/#toc

It is this peace of code that gives me trouble because i dont know where to write it.

object IdTCPServer1: TIdTCPServer
  CommandHandlers = <
    item
      Command = 'test'
      Name = 'TIdCommandHandler0'
      ParseParams = False
      ReplyNormal.NumericCode = 100
      ReplyNormal.Text.Strings = (
        'Hello from your Indy Server')
      ReplyNormal.TextCode = '100'
    end

Solution

  • That is part of a DFM file of a form with a non-visual component called TIdTCPServer on it. Just place such a component on your form and use the property editor to set the properties to the given values. For example, you have to add a command handler (using the CommandHandlers property) and set its Command property to "test".