Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DFHGRID.VCX
Message
 
 
To
01/04/1998 23:32:47
Michael Haggerty
Blue Mountain Data Systems Inc
Herndon, Virginia, United States
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Title:
Miscellaneous
Thread ID:
00088869
Message ID:
00088986
Views:
34
Michael,

Well I'd been meaning to integrate that code fragment for a while now, your message gave me the impetus to do it.

On the shape, remove the MouseDown() and put this in the MouseUp() instead:

LPARAMETERS nButton, nShift, nXCoord, nYCoord

* converts a mouse click in the shape to activate the underlying grid cell

local lnRow, lnCol, lnWidth, loGrid

lnWidth = 0
nXCoord = nXCoord - this.Left

loGrid = evaluate( "this.parent." + this.mcGridName )

lnRow = int( 1 + ( this.Top - ( loGrid.Top + loGrid.HeaderHeight ) ) / loGrid.RowHeight )

for lnCol = loGrid.LeftColumn to loGrid.ColumnCount
   lnWidth = lnWidth + loGrid.Columns[lnCol].Width + loGrid.GridLineWidth
   if ( lnWidth > nXCoord )
      exit
   endif
endfor

lnCol = lnCol - loGrid.LeftColumn + 1

loGrid.SetFocus()
loGrid.ActivateCell( lnRow, lnCol )

The only thing I don't like about this though is that if you keep the highlight visible while the grid has focus, or click back into the same grid row the click won't feed though and position the I-beam cursor at the position of the mouse
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform