Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Access Method
Message
From
21/12/2019 05:50:55
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Title:
Miscellaneous
Thread ID:
01672305
Message ID:
01672367
Views:
69
>My actual case is different than the example in the initial message. The initial message of the thread had an example of making the textbox background color customizable by user. Your approach - not the Access method - but the fact that some other class can get the custom version, one time, is very helpful. So, for that I thank you very much. Let me describe the actual case:
>My textbox have a code in the method GotFocus where the background color is set to a different color. That is, when a user clicks on a textbox, the backcolor changes to a distinct color. This distinct color is hardcoded in a property of the base textbox class. When a user leaves the textbox, the backcolor changes back to default.
>Now, I won't have to use this hard-coded approach; but rather read a value from a configuration file - ONE TIME AT THE TOP OF APPLICATION - and set the value to the property of the application object (property TEXT_BCOLOR_FOCUS). Then the value in this property will be used in all textboxes. Since reading of an external configuration file will be necessary only one time speed will be quite adequate.

And Thomas's trick will serve exactly the same. You set goapp.backcolor and other predefined colors by reading a config instead of hardcoding a color. That's the only difference.

Using his method, when you instantiate any of these textboxes, there are no method calls, no code in the init. It's only these color properties which have goApp.someColor as values - which will be referenced only the first time; the other instances of the same class will inherit the value as it is, without referencing goApp.someColor again. Which is weird and I haven't tested it yet, but I trus Thomas did. There's a simple way to check this - have a goapp.someColor_access method call aStack() function and log its contents. If he's right, there should be just one call (per class, that is), not one for each instance.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform