Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Assign method works sporadically with objects
Message
De
16/08/2002 14:14:43
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00690435
Message ID:
00690468
Vues:
17
>I have this code...
>
>
>  WITH THIS.TimerObj
>    *-- Send the header of this column to the timer
>    loHeader =  THIS.Parent.Header1
>    .HeaderObj = loHeader
>
>
>I'm assigning it to a variable first for debugging. The timer's HeaderObj property has an assign method. When it gets there, sometimes the header is passed in properly and sometimes it shows up as null. If I suspend, I can see that loHeader lways has a value.
>
>Is there some bug with ASSIGN and objects? Why would it work sometimes and not others?
>
>Thanks,
>
>Michelle

Michelle,


(1) Any means of getting rid of the timer ?

(2) maybe

>
 WITH THIS.TimerObj
    *-- Send the header of this column to the timer
    .Enabled = .F.
    loHeader =  THIS.Parent.Header1
    .HeaderObj = loHeader
    .Enabled= .T.
(3) Do not know if the following will apply to your situation

I have found out that the timer event may kick in during refreshes of objects (and maybe other events/methods too, I do not know)
When this happens, the THIS in the timer may refer to another object which method/event was interrupted. This may lead to errors and unforeseen situations

I do not know whether this applies to you

The way I got around this ..

Timer.Event()
local obj
obj = this
if( obj.BaseClass == 'Timer' )
   && process the event

else
  && wait for next event
  && uncomment following line to see whether this applies to you
  && assert .F. message 'this is not a timer'
endif
I can only guess. Maybe if the timer fires, the THIS of the assign method is wrong

You may add the above code to the assign method as well
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform