Because a property hides the implementation details ... you can change to read / write methods later with no change to the code that is using the property. A public field exposes the implementation.

Cheers

D


On 21/01/11 00:44, Ross Levis wrote:

I don't see the point in doing that, unless the read/write are functions or procedures. Just make the string public.

*From:*delphi-boun...@delphi.org.nz [mailto:delphi-boun...@delphi.org.nz] *On Behalf Of *David Moorhouse (DUG)
*Sent:* Thursday, 20 January 2011 11:18 PM
*To:* NZ Borland Developers Group - Delphi List
*Subject:* Re: [DUG] Variabels stored

Or as field properties if you want to access them from another form ...

type

    TWallaceForm = class(TForm)

       btnOK: TButton;

    private

      FWallacesPrivateVar: string;     // private storage

     public

property WallacesPrivateVar: string read FWallacesPrivateVar write FWallacesPrivateVar;

  ...

    end;

Cheers

D

On 20/01/11 16:09, Conor Boyd wrote:

Probably as a field on the form class that you're dealing with.

e.g.

type

    TWallaceForm = class(TForm)

       btnOK: TButton;

    ...

      txtWallacesHiddenTextBox: TEdit;

    ...

    private

FWallacesPrivateVar: string; // use this instead of your hidden text box.

// Can create as many "variables" (or fields as they're known in Delphi parlance, hence the F prefix)

// of as many different types as you like.

    ...

    end;

Hope I've understood what you're asking for correctly.

HTH,

Conor

*From:*delphi-boun...@delphi.org.nz <mailto:delphi-boun...@delphi.org.nz> [mailto:delphi-boun...@delphi.org.nz] *On Behalf Of *Marshland Engineering
*Sent:* Thursday, 20 January 2011 3:45 p.m.
*To:* delphi@delphi.org.nz <mailto:delphi@delphi.org.nz>
*Subject:* [DUG] Variabels stored

Is there a way to store variables so I can use them from one procedure to another?

I have been currently storing them in hidden edit.text boxes on the form but there must be a better way.

Cheers Wallace

_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post:delphi@delphi.org.nz <mailto:delphi@delphi.org.nz> Admin:http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email todelphi-requ...@delphi.org.nz <mailto:delphi-requ...@delphi.org.nz> with Subject: unsubscribe


_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: 
unsubscribe

_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: 
unsubscribe

Reply via email to