Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Gridhighlighter Invalid dynamic forecolour - problem
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00770867
Message ID:
00771560
Vues:
11
>>>>Elmer may be right, if it happens on form closing. Maybe because of the changes in ZOrder of the form controls GHL gets destroyed before the grid. Then, when grid tries to evaluate the Dynamic... properties one last time, GHL is already not there and GHL.nRecno property (that Dynamic.. expression checks) also is gone already, which causes Invalid Dynamic expression... error.
>>>>
>>>>GHL itself has the code in Destroy method that checks for the grid existence and resets the Dynamic properties to nothing. But if the object destruction happens in the reverse order, the Dynamic expression may point to non-existent GHL control property.
>>>>
>>>
>>>If you have such code, then the whole situation doesn't make much sense. Only if we suspect partial descruction of GHL, then grid destruction, then finishing with GHL. Weird indeed. It would be good to have an easy reproducable scenario.
>>
>>>Did you try to create a form, add GHL first, then the grid? Would you have this problem?
>>
>>Yes, I tried that and the form and highlighting still work properly on form open/close.
>>
>>The code in ghl.Destroy() is
>>
>>*** GHL.Destroy()
>>lcHost = THIS.cHostname
>>* Make sure that grid still exists, as it might be destroyed already if ZOrder was changed later.
>>IF TYPE("THIS.PARENT.&lcHost.") = "O" AND !ISNULL(THIS.PARENT.&lcHost.)
>>   WITH THIS.PARENT.&lcHost.
>>      .SETALL("DynamicBackColor", [''], "Column")
>>      .SETALL("DynamicForeColor", [''], "Column")
>>      .SETALL("DynamicFontBold", [''], "Column")
>>   ENDWITH
>>ENDIF
>>
>
>Looks fine, though could be re-written this way:
>
>loGrid = evaluate('this.parent.'+this.cHostName)
>if vartype(loGrid)<>'X' && Don't remember, if X refers to null
>  with loGrid
>    ..
>  endwith
>endif
It can be rewritten in a number of ways :) but it has to be compatible with VFP 5. And I try to avoid creating the object references in GHL as much as possible, as the dangling object reference in GHL may affect the user's application.
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform