Article ID: 146222
Article Last Modified on 9/30/2003
****** Start of Grid MouseDown
*************************************************************
* If the grid is on a form (not in a container or pageframe),
* this section may be omitted. It iterates through
* object nesting level for all objects above the grid in the
* hierarchy and makes necessary adjustments to nXCoord and
* nYCoord. This allows the NODEFAULT to be called at the appropriate
* time regardless of whether the grid is in a container, page in
* a pageframe, or a combination that contains several layers.
LOCAL cObjlist, nTopTotal, nLeftTotal
cObjlist = ''
nLeftTotal = 0
nTopTotal = 0
cObjlist = SYS(1272,this) && Get object hierarchy for grid
IF TYPE('ThisFormSet') = 'O' && In a Formset?
* If so, remove Formset from object list
cObjlist=SUBSTR(cObjlist,AT('.',cObjlist)+1)
ENDIF
* Strip off grid name and replace form name with 'thisform'
cObjlist='thisform' + SUBSTR(cObjlist,AT('.',cObjlist), ;
RAT('.',cObjlist) - AT('.',cObjlist))
IF !'thisform'==(cObjlist) && Something more than thisform in hierarchy?
FOR i=1 TO OCCURS('.',cObjlist) && Number of '.'s = depth of hierarchy
IF TYPE("EVAL(cObjList+'.left')")='N' && Does Obj have Left property?
nLeftTotal = nLeftTotal+EVAL(cObjlist+'.left') + ;
IIF('3.10' $ OS(1) OR 'NT' $ OS(1),1,0) && Add it in
ENDIF
IF TYPE("EVAL(cObjList+'.top')")='N' && Does Obj have Top property?
nTopTotal=nTopTotal+EVAL(cObjlist+'.top') && Add it in
ENDIF
IF EVAL(cObjlist+'.baseclass')='PageFrame' && Is object a PageFrame?
IF EVAL(cObjlist+'.tabs')=.T. && Does PageFrame have Tabs?
nTopTotal=nTopTotal+24 + ;
IIF('3.10' $ OS(1) OR 'NT' $ OS(1),2,0) && Add in Tab height
ELSE
nTopTotal=nTopTotal + ;
EVAL(cObjlist+'.borderwidth') + ;
IIF(EVAL(cObjlist+'.SpecialEffect')<2,1,0)
nLeftTotal=nLeftTotal+EVAL(cObjlist+'.borderwidth')
ENDIF
nLeftTotal=nLeftTotal+1+ IIF('3.10' $OS(1) OR 'NT' $ OS(1),1,0)
ENDIF
* Pare last object from list
cObjlist=SUBSTR(cObjlist,1,RAT('.',cObjlist)-1)
ENDFOR
ENDIF
nXCoord=nXCoord-nLeftTotal && Compensate nX- and nYCoord for top and left
nYCoord=nYCoord-nTopTotal && of all containers that hold the Grid
*
* End of section to omit if grid is directly on form
****************************************************
WITH this
* Each of these checks the position of the mouse when the MouseDown
* is called. If the position is where the click should be ignored,
* NODEFAULT is issued.
* This makes rows not resizable
IF nXCoord < .partition + .Left + 20 AND ;
nYCoord > .Top + .HeaderHeight + .RowHeight - 5 AND ;
nYCoord < .Top + .HeaderHeight + .RowHeight + 7
NODEFAULT
ENDIF
* This makes header not resizable
IF nXCoord < .partition + .Left + 20 AND ;
nYCoord > .Top + .HeaderHeight - 5 AND ;
nYCoord < .Top + .HeaderHeight + 7
NODEFAULT
ENDIF
* This makes partition not moveable
IF MOD(.ScrollBars,2) = 1 && Check for horizontal scrollbar
IF nXCoord < .partition + .Left + 6 AND ;
nXCoord >= .partition + .Left AND ;
nYCoord > .Top + .Height - 19
NODEFAULT
ENDIF
ENDIF
ENDWITH
IIF('3.10' $ OS(1) OR 'NT' $ OS(1),1,0)
Additional query words: VFoxWin
Keywords: kbcode KB146222