Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Determing what an object is in.. i.e is it in a grid??
Message
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00267662
Message ID:
00268168
Views:
22
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
Previous
Reply
Map
View

Click here to load this message in the networking platform