Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Eliminating multiple refresh()
Message
From
29/04/2002 02:34:05
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
 
 
To
29/04/2002 01:32:51
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00650236
Message ID:
00650249
Views:
20
>Whenever a container has code in it's REFRESH(), all the controls in it get REFRESH()ed twice. Once during the DODEFAULT() in the Container.REFRESH() code and again when the Container.REFRESH() ends. Which means that a textbox in a container in a container in a form gets REFRESH()ed 8 times if the Form.REFRESH() has code and each of the containers have code.
>
>I'm looking for a way to eliminate the redundant REFRESH()es.
>
>I'm thinking of putting a test in the base classes of all controls that determines if it was called with DODEFAULT() or not, and if so NODEFAULT.
>This means I have to figure out how to determine if DODEFAULT() called it.
>Any ideas?
>
>Or maybe a better way to eliminate the duplicate REFRESH()ing?
>
>TIA

Hi Bill,

Try the following will avoid doubble fire
...
DODEFAULT()
NODEFAULT
...
in your container.

but this will not resolve the problem with a box called from a container and do on

If you need to call one refresh out of the next you need to block it at the topmost Refresh, so that the refresh called from there will not fire.

I do the follow for things similar to this problem:

I create a new property to the Form, lets' say "glRefresh"
In each and every of the modified refresh event's I need to modify
LOCAL;
 llThisLocks

IF EMPTY(THISFORM.glRefresh) THEN
 THISFORM.glRefresh = .T.
 llThisLocks        = .T.
ELSE &&EMPTY(THISFORM.glRefresh)
 llThisLocks        = .F.
 NODEFAULT
ENDIF &&EMPTY(THISFORM.glRefresh)
...
*eventcode example:
DODEFAULT()
THIS.txt.REFRESH()
...
IF llThisLocks THEN
 THISFORM.glRefresh = .F.
ENDIF llThisLocks
But there is one other thing to say:
It is allways a good idea to remove code from REFRESH() event and put it in a custom method.
REFRESH will be called under a lot of circumstances and code inside it can real slow down your forms.

The most settings I need to do are depending on recordchange, activate of a form, not on REFRESH.

HTH
Agnes
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform