You need to use column textboxes RightClick event for this.
Or look at BindEvent() function.
I have an old code that replace a specified method for a control in grid in all columns in form designer.
ChangeGridMethod('Text1','RightClick',_cliptext)
if the method code is copied into clipboard
PROCEDURE ChangeGridMethod
LPARAMETERS tcControlName,tcMethodName,tcMethodCode
LOCAL lnSelObjectCount, loGridRef, lnCnt, loControlRef
LOCAL ARRAY laSelectedObject[1]
lnSelObjectCount = ASELOBJ(laSelectedObject)
IF lnSelObjectCount = 0
WAIT WINDOW 'Select a grid in Form Designer first' nowait
RETURN
ENDIF
loGridRef = laSelectedObject[1]
IF loGridRef.BaseClass # 'Grid'
WAIT WINDOW 'One Grid object must be selected' nowait
RETURN
ENDIF
FOR lnCnt = 1 TO loGridRef.ColumnCount
IF type("loGridRef.Columns(lnCnt)."+tcControlName) = 'O'
loControlRef = EVALUATE("loGridRef.Columns(lnCnt)."+tcControlName)
loControlRef.WriteMethod(tcMethodName,tcMethodCode)
ENDIF
NEXT
>Hi,
>
>I have a grid in a form just to show information (no updates allowed), where I set
"ReadOnly to .T." and
"AllowCellSelection to .F.". There is, also the option to RightClick over the Grid and have access to a PopUp where some options are presented.
>
>Users asked me to let the Grid cells text to be accessed so they could copy its content and to paste it elsewhere. In order to do that I changed the setting of
"AllowCellSelection to .T.", and it worked as users desired. The problem is that the Grid's RightClick event isn't firing anymore.
>
>Is there a way to bring that functionality (RightClick) back while keeping the cells "open" to copy their text?
>
>TIA,
>
>Fernando