Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
A question about screen.activeform.refresh?
Message
 
To
06/11/1997 21:37:18
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00058701
Message ID:
00058921
Views:
35
>Hi Erik and thanks a lot for helping. I thought REFRESH was a simple
>redraw, but it is not. My biggest problem is keeping track of all the
>code I write and where it lives. I know I can print out the FORM with
>the CLASS BROWSER, but my FORM in this app I am writing has two page tabs
>and manying objects. How do I organize my code and remember where all
>my code is? :)))))
Robert,

This may sound pedantic but it is certainly true, if you were to design the form BEFORE you started coding it you would then know where all the code is going to be and what it is going to be doing.

One of the problems with this object model is that code gets spread around because each object is responsible for its own existance. This places a much higher requierment for a solid design before you start coding. The old days of monolithic prgs and procedures where one could simply scroll back a few lines or pages and see the other code are gone. We now must know how the objects will interact and which object will be responsible for which behavior and so forth. We need to know this stuff BEFORE we start coding aso we put the code in the right places and so there is a map (our design document) that tells us where to look to find the code for a certain behavior.

We also need to understand the various events and methods and what they do and when they fire in order to put the code in the right place in the first place.

Just take this compariwson for an example, in FP 2.6 a textbox style data entry control had two events, WHEN and VALID, with minimal study we could understand these two events and use them to our advantage. In VFP a textbox control has 40+ properties, events, and methods to reach an understanding of all of these is a lofty persuit to say the least.

Just as an example let's simply look at four of these events, GotFocus, When, LostFocus, and Valid. Now at first glance When and GotFocus seem to be redundant, but they aren't. When's purpose in life is to determine if focus will be allowed into the control, it does this by returning a vlaue of T or F where T allows focus in and F does not. GotFocus is on the other hand an event that fires if the control is going to get the focus, that is WHEN has already determined that focus will be allowed into the control, so GotFocus is the opportunity to deal with the fact that the user is going into the control and getting ready for that eventuality.

Valid and LostFocus are similar in that Valid determines if focus will be allowed to leave the control and LostFocus delas with what needs to happen when focus leaves the control.

You take this same level of understanding to the Refresh method and you will see that the purpose of the refresh method is do whateer you need to do because the control is being refreshed. In many cases this is nothing and so you put no code in the refresh method. But in other cases you may not be using the controlsource property and so you have tos et the vlaue of teh control somehow when it is refreshed, so you put the code in the control's refresh method.

If you have code in a refresh of a control that is not simply dealing with the refeshing of that control then this is a design flaw.

Many of the questions that seem unanswerable are really the result of trying to write code before we know what code we need to write and why. Deciding what code we need and wehre to put that code is called design and in a object oriented environment there is no way to get away from a solid analysis and design phase in a project.

As Steven Black says in his presentations on this subject, "Eventually, you WILL do a complete analysis and design." It may at the beginning of the project and make the whole development go smoothly, or it may be later on and cause you to spend hours tracing down some bug or another only to find you have to scrap the whole thing and start over again.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform