#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2002
    Posts
    86
    Rep Power
    13

    A stupid programming question "period"..


    Hi, I'm busy learning Delphi and using the ImageEn component...

    I've noticed in the source code in their examples the call to a function like this:

    TMainForm.ImageEnMView1ImageAtPos

    Where: ImageEnMview is the object with ImageAtPos being a function...

    My question is why is there no period separating the function and the object? I would have thought this to be needed?

    i.e. TMainForm.ImageEnMView1.ImageAtPos (which throws an error) this is probably fundamental but your answer will help me to further my Delphi :-)

    Thank you in advance.

    Greg.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2008
    Posts
    356
    Rep Power
    7
    Originally Posted by dlumley
    Hi, I'm busy learning Delphi and using the ImageEn component...

    I've noticed in the source code in their examples the call to a function like this:

    TMainForm.ImageEnMView1ImageAtPos

    Where: ImageEnMview is the object with ImageAtPos being a function...

    My question is why is there no period separating the function and the object? I would have thought this to be needed?

    i.e. TMainForm.ImageEnMView1.ImageAtPos (which throws an error) this is probably fundamental but your answer will help me to further my Delphi :-)

    Thank you in advance.

    Greg.
    I don't use ImageEn, so my answer will not be specific to that component, but in context here, the "Object" is the form which is referred to by TMainForm and the Method is ImageEnMView1ImageAtPos

    If you look within the type declaration at the top of your source code, you should see something like this:
    Code:
    TMainForm = class(TForm)
       ...
       Imageen1: TImageeN;
       procedure ImageEnMView1ImageAtPos(<params if any>);
    private
       ...
    public
    
    end;
    then the procedure body would be defined in the implementation section

    Code:
    procedure TMainForm.ImageEnMView1ImageAtPos(...
    If you add a BitBtn to your form, and add a OnClick handler, the method added to your form class would be:

    procedure BitBtn1Click(Sender: TObject);

    and in the implementation would be

    procedure TMainForm.BitBtn1Click(Sender:TObject);
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2006
    Location
    Carlsbad, CA
    Posts
    2,057
    Rep Power
    383
    To expand on what majlumbo explained:

    The procedure is just a method of the form.
    The fact that the IDE auto-names it ImageEnMView1ImageAtPos is simply a convention
    to help we human programmers to remember its context.

    Clive
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2002
    Posts
    86
    Rep Power
    13

    Thank you for replying... it is slowly falling into place.


    Greg.

IMN logo majestic logo threadwatch logo seochat tools logo