>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
Here to find if control is in the grid. You can play with it.
WITH Thisform.MyGrid
FOR i = 1 TO .ColumnCount
WITH .Columns[i]
FOR ii = 1 TO .ControlCount
cClassName = UPPER(.Controls[ii].BaseClass)
If cClassName = 'TEXTBOX' && example condition
lClassExist = .T.
ENDIF
ENDFOR
ENDWITH
ENDFOR
ENDWITH
<\PRE>
JESS S. BANAGA
Project Leader - SDD division
...shifting from VFP to C#.Net
CHARISMA simply means: "Be more concerned about making others feel good about themselves than you are in making them feel good about you."