Mike,
Use the TYPE command to test for an actual object before examining its properties. Try something like...
This.inGrid = TYPE("This.Parent.Parent") == "O" AND ;
This.Parent.Parent.ParentClass == 'Grid'
>I have taken the sample date time class from this site.. (The one that pops up a claendar, +,- moves days, etc..) and I want to change it to do the following: When the object is in a grid, the pgup and pgdn function keys do not affect it.
>
>I need to findout how I can find out if it is in a grid. I then set a propert called ingrid to .t. which in the keypress event disables the processing of the pgup and pgdn keys.
>
>I have tried the following, in the init method:
>*- Check to see if contol is in a grid
>if this.parent.parent.parentclass='Grid'
> this.inGrid=.t.
>else
> this.inGrid=.f.
>endif
>
>It works fine if the control is in a grid, however if the control is on a form it crashes with:"Parent is not an object".
>
>How can I make the control code generic so that if it is on a form that it sets inGrid to .f. and if it is in a Grid to .t.?
>
>Thanks in advance
>Mike
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement