Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Ken Murphy
  Where is Ken Murphy?
 Springhill
 Canada
 Ken Murphy
 To: Ahsan Rana
  Where is Ahsan Rana?
 Lahore
 Pakistan
 Ahsan Rana
 Tags
Subject: RE: _Screen.Property
Thread ID: 143128 Message ID: 143165 # Views: 4 # Ratings: 0
Version: Visual FoxPro 9 Category: Databases, Tables and SQL Server
Date: Saturday, August 25, 2007 2:11:03 PM         
   


> Hi Experts
>
> Is it possible to save any public variable in _Screen to use any wahere in App. If Yes then How...
>
> Rgds:
> Ahsan rana

Ahsan,

Just to pull together what others have offered. You can add as many properties as you want to _Screen. For example, you could add all the properties you need to save the existing environment at startup. Using the code that Bernard gave you,
_SCREEN.AddProperty("cOldSafety",SET([Safety]))
_SCREEN.AddProperty("cOldTalk",SET([Talk]))
...


On the other hand, Cetin quite correctly suggests that you use a custom class to hold these properties. When you think about it, that makes a certain amount of sense. If you add these custom properties to _SCREEN, then you are going to have to do it for every single application. VFP is an OOP language, so you can take advantage of inheritence here. Create a custom class (based on custom) and add all your properties to that class. Now, in the class's .Init(), you would issue a series of:
This.cOldSafety = SET([Safety])
This.cOldTalk = SET([Talk])
...

You then create a single custom property in _Screen called .oApp (or what ever) and you use it to hold an instance of your custom class. Now, instead of having to issue all those .AddProperties in your Main.Prg, you only have to add one. (I always like it when I can program something once and then use it where ever I need it.

Ken
You shall know the truth - and the truth shall set you free. (John 8:33)

ENTIRE THREAD

_Screen.Property Posted by Ahsan Rana @ 8/25/2007 5:58:06 AM
RE: _Screen.Property Posted by Bernard Bout @ 8/25/2007 7:14:52 AM
RE: _Screen.Property Posted by Tariq mehmood @ 8/25/2007 12:17:41 PM
RE: _Screen.Property Posted by Cetin Basoz @ 8/25/2007 12:47:48 PM
RE: _Screen.Property Posted by Andy Kramek @ 8/25/2007 12:57:15 PM
RE: _Screen.Property Posted by Ken Murphy @ 8/25/2007 2:11:03 PM
RE: _Screen.Property Posted by Ahsan Rana @ 8/25/2007 7:49:51 PM
RE: _Screen.Property Posted by Marcia Akins @ 8/25/2007 9:15:57 PM
RE: _Screen.Property Posted by Syed Nadeem Iqbal @ 8/26/2007 4:32:33 AM
RE: _Screen.Property Posted by Ken Murphy @ 8/26/2007 2:50:34 PM
RE: _Screen.Property Posted by Benny Thomas @ 8/26/2007 3:37:53 PM
RE: _Screen.Property Posted by Ken Murphy @ 8/26/2007 3:48:51 PM
RE: _Screen.Property Posted by Syed Nadeem Iqbal @ 8/26/2007 7:24:18 PM
RE: _Screen.Property Posted by Marcia Akins @ 8/27/2007 4:19:27 PM
RE: _Screen.Property Posted by Benny Thomas @ 8/26/2007 8:34:50 AM
RE: _Screen.Property Posted by Ken Murphy @ 8/26/2007 2:26:07 PM
RE: _Screen.Property Posted by Marcia Akins @ 8/27/2007 4:22:38 PM
RE: _Screen.Property Posted by Benny Thomas @ 8/26/2007 10:01:16 AM
RE: _Screen.Property Posted by Ken Murphy @ 8/26/2007 2:53:52 PM
RE: _Screen.Property Posted by Marcia Akins @ 8/27/2007 4:24:06 PM
RE: _Screen.Property Posted by Ken Murphy @ 8/27/2007 5:15:36 PM
RE: _Screen.Property Posted by Benny Thomas @ 8/28/2007 8:33:23 AM