Delphi Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreDelphi Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 11th, 2012, 04:07 AM
dlumley dlumley is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2002
Posts: 86 dlumley User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 29 m 26 sec
Reputation Power: 12
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.

Reply With Quote
  #2  
Old May 11th, 2012, 01:36 PM
majlumbo majlumbo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2008
Posts: 257 majlumbo User rank is Lance Corporal (50 - 100 Reputation Level)majlumbo User rank is Lance Corporal (50 - 100 Reputation Level)majlumbo User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 3 Days 9 m 16 sec
Reputation Power: 6
Quote:
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);

Reply With Quote
  #3  
Old May 11th, 2012, 02:27 PM
clivew clivew is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jan 2006
Location: Carlsbad, CA
Posts: 2,045 clivew User rank is Major (30000 - 40000 Reputation Level)clivew User rank is Major (30000 - 40000 Reputation Level)clivew User rank is Major (30000 - 40000 Reputation Level)clivew User rank is Major (30000 - 40000 Reputation Level)clivew User rank is Major (30000 - 40000 Reputation Level)clivew User rank is Major (30000 - 40000 Reputation Level)clivew User rank is Major (30000 - 40000 Reputation Level)clivew User rank is Major (30000 - 40000 Reputation Level)clivew User rank is Major (30000 - 40000 Reputation Level)clivew User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 2 h 37 m
Reputation Power: 382
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

Reply With Quote
  #4  
Old May 13th, 2012, 11:19 AM
dlumley dlumley is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2002
Posts: 86 dlumley User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 29 m 26 sec
Reputation Power: 12
Thank you for replying... it is slowly falling into place.

Greg.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreDelphi Programming > A stupid programming question "period"..

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap