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:
00771544
Vues:
12
>>>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
Did you try to messagebox grid's dynamic properties in that code to make sure, they are reset?

I guess, something else is going on here. Colin, do you have any code in Destroy, Unload, Release methods of any of form's controls or the form itself?

>As you can see, if GHL is destroyed first, it supposed to reset Grid's Dynamic properties to empty state. The grid then should not error out on Dynamic properties unless there is something weird going on and Dynamic... properties retain their expressions somehow after GHL is destroyed.
>
>Maybe it worth a try to recreate the grid control from scratch.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform