My only question would be what benefit do you get from using
pointers to do this?  If, for example, unit2 has your mainunit in it's uses
clause you can do anything with the component on your mainform from Form2
that you can directly from within your mainform!  For example to ensure an
edit1 component on your mainform is displaying the required text here's how
you would do it from both units:

//From your unit2
If MainForm.Edit1.text <> 'ReqText' then
MainForm.Edit1.text := 'ReqText';

//From your mainform:
if Edit1.text <> 'ReqText' then
Edit1.text := 'ReqText';

        The only difference is that you do not have to reference the Form
the component is on when writing the code in that Form's unit! 

>From "Robert Meek" 
Personal e-mail:  [EMAIL PROTECTED]
dba / "Tangentals Design"
Visit us at:  www.TangentalsDesign.com
Home of "The Keep"!

Member of:  "Association of Shareware Professionals"
Moderator for:  "The Delphi", "Delphi-DB", and "Delphi-Talk"
programming lists at elists.org, and "DelphiTalk.net"
at www.DelphiTalk.net


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Gerry Bendixen
Sent: Tuesday, March 15, 2005 9:57 AM
To: [email protected]
Subject: Pointer Usage

Hi all,
Recently the concept of using pointers has been discussed with some
favorable and some unfavorable comments.  Not being an expert, I have
resorted to using pointers for one specific purpose and now I am questioning
whether my approach is optimum.
Here's the situation:
I have a 'main' unit that holds the main form with some components that I
want to be accessable by 'used' units.  (TProgressBar, TEdit, etc.)
I declare a pointer to the component, assign a value in the main unit and
use the pointer in 'used' units to access the component.

My question is whether there are better concepts to achieve this
functionality.

Thanks in advance for any hints.
Gerry Bendixen
_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi


_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to