Thanks Cetin. Actually my grid is read only (it's on a 'Find' screen), so perhaps that's why I get 'column' as the object. I was trying to set the column to 'find by' using a click on the header. I didn't want a click in the column to trigger the code in the header if there WERE records in the grid. However, when there are records, a click in the grid doesn't fire the form click method. The following code seems to work fine.
LOCAL oObj
oObj = SYS(1270)
IF UPPER(oObj.BASECLASS) = 'COLUMN'
oObj.header1.CLICK()
ENDIF
John
>Elyse,
>If it's returning column then there is something wrong page getting click (grid enabled = .f., when returning .f. ?). Here is a more generic version that frees you from also knowing the grid name (John for header click catch I embedded GridHitTest usage in code) - directly using loObj.parent might be dangerous :
>
>
loGrid = .Null.
>loObj = Sys(1270)
>If Upper(loObj.BaseClass) # 'GRID' And Type('loObj.Parent')='O'
> Do While Type('loObj.Parent')='O'
> loObj = loObj.Parent
> If Upper(loObj.BaseClass) = 'GRID'
> loGrid = loObj
> Exit
> Endif
> Enddo
>Else
> loGrid =loObj
>Endif
>
>If !Isnull(loGrid)
> Store 0 To lnWhere, lnRelRow, lnRelCol,lnPanel
> loGrid.GridHitTest(Mcol(Wontop(),3),Mrow(Wontop(),3), ;
> @lnWhere,@lnRelRow,@lnRelCol,@lnPanel)
> If lnWhere = 1
> Wait Window 'Header of relative column '+Transform(lnRelCol) TIMEOUT 2
> Endif
> loGrid.RightClick()
>Endif
>
Cetin
>
>
>
>>Cetin,
>>
>>Is there anyway to trap the click event in the column header? Clicking on the header or in the column returns 'COLUMN' as the base class. I just need to trap the header click.
>>
>>TIA
>>
>>John
>>
>>>
>>>Yes Elyse,
>>>It doesn't get the focus :(
>>>You could have code in page rightclick like this :
>>>
>>>loObj = SYS(1270)
>>>IF UPPER(loObj.BaseClass) = 'GRID'
>>> loObj.RightClick()
>>>endif
Cetin