Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Access or Not
Message
From
23/12/2019 02:54:44
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
01672405
Message ID:
01672409
Views:
47
Hi Dmitry, for me both are correct, depending on the purpose/ requirements of your app, right now I can't say it would be better to have the control over app (1st option oApp.TEXT_BACK_COLOR_FOCUS) or just over class by class (text1.back_color_focus).
Thinking in RAD I would say that global oApp option is better because is more centralized that having the control in the vcx file.
BTW having a table to store the configuration for TEXT_BACK_COLOR_FOCUS and/or all the rest of the custom colors, is even more recommended due the end user of the app will have opportunity to decide about it too, the oApp object can read from there and the rest of the code remains the same.


>>
>>Hi,

Sorry for beating this dead horse. (I used to make these decisions without thinking; now I am overthinking :)

I need to decide which method to use.
All my base textbox classes have the following code in GotFocus method (the purpose of which is to set the backcolor of a textbox to something different):
this.BackColor = RGB(0,255,64)
I created a property of the global application object (oApp), TEXT_BACK_COLOR_FOCUS. The value in this property is set to be RGB(0,255,64) or loaded and set from a user-specific configuration file.

Method 1:
Use the value of this property TEXT_BACK_COLOR_FOCUS instead of the hard coded:
this.BackColor = oApp.TEXT_BACK_COLOR_FOCUS
Method 2
Set a value oApp.TEXT_BACK_COLOR_FOCUS to a custom property of the text box (e.g. BACK_COLOR_FOCUS) using the ACCESS method (discussed in another thread). Then set the value of this.BackColor as follows:
this.BackColor = this.back_color_focus
Which of the above, in your opinion, is a better practice?

TIA
John Harold Belalcázar Lozano
Associate Director Of Development
http://www.belvicto.co/
jhbelalc@gmail.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform