Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Eliminating multiple refresh()
Message
From
29/04/2002 10:11:30
 
 
To
29/04/2002 02:34:05
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00650236
Message ID:
00650364
Views:
15
I have a related question. I work with an accounting system called Accountmate. They have a set of classlibraries used on all their forms. I am trying to rework their class libraries for a number of reasons. But I didn't realize there is so much overhead with refresh(). In the refresh of each of their control classes, they have a line: this.enabled=thisform.editmode
Each form starts out with editmode false, with the focus in a lookup control (the lookup controls refresh is: this.enabled=!thisform.editmode) After the user does a key lookup and selects a key value, the editmode is switched to true, and then a thisform.refresh() is called.

So, my question is: what would be a more efficient way to reset the enabled property for each control on the form?

TIA


>>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform