Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Access or Not
Message
 
 
À
23/12/2019 02:54:44
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
01672405
Message ID:
01672416
Vues:
33
Hi John,
Thank you very much for your input. The configuration for TEXT_BACK_COLOR_FOCUS is indeed stored in a file (XML file).
My biggest concern with both methods is that I use this base text box in other programs. And if I implement this approach of using the global application object (oApp), the text box will depend on it. And in a program where there is no oApp, the text box will be broken.
So far, the only way around is to have the value of TEXT_BACK_COLOR_FOCUS loaded in the text box Init or some other method and do away with using the oApp. But then the advantage of the Thomas Ganss' approach will be lost.
I will think about it more.

>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
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform