Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Activating a cell in a grid with a dragdrop
Message
 
 
To
08/01/1999 02:28:05
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00173838
Message ID:
00174106
Views:
23
>>I have to drop a value into a cell in a grid. How do I activate the cell I'm droping on.
>>My dragdrop is working when I activate the cell by clicking it before I start the dragdrop.
>>I saw the gridhittest method, how do I use it? Or even is it the way to go.
>>
>>thanks
>>
>>--D
>Dean,
>This might help :
*Grid.dragover
>LPARAMETERS oSource, nXCoord, nYCoord, nState
>WITH this
> IF nState = 0
>   .setfocus()
>   oSource.dragicon = iif(oSource.lMoveOperation, ;
>                     oSource.MoveIcon,oSource.CopyIcon)
>  ENDIF
>* IF nState = 1
>    if !(between(nXcoord, .left+2, .left+.width-2) ;
>       and between(nYcoord,.top+2,.top+.height-2))
>	oSource.dragicon = oSource.NoDropIcon
>    endif	
>* ENDIF
> nNewRow = int((nYCoord - .headerheight - .top)/.rowheight)+1
> IF .scrollbars < 2 ;
>   or nXCoord < .width - sysmetric(5)	&& Doesn't have vertical scrollbar or not on vertical bar area
>	DO case
>	CASE nYCoord < .top+.headerheight+.rowheight/3	&& Top thirds of top row
>		.doscroll(2)				&& Scroll page up
>	CASE nYCoord > .top+.height-.rowheight/3 && Bottom thirds of bottom row
>		.doscroll(3)				&& Scroll page down
>	ENDCASE
>  ELSE	&& On vertical bar area
>   lnVerticalBarEnd = .height - iif(.scrollbars = 3, sysmetric(8), 0)
>   DO case
>	CASE between(nYCoord-.top, 0, sysmetric(6))    	&& On Top scroll arrow
>		.DoScroll(0)				&& Scroll up
>	CASE between(nYCoord-.top, ;
>		lnVerticalBarEnd - sysmetric(6), ;
>		lnVerticalBarEnd)		&& On bottom scroll arrow
>		.DoScroll(1)			&& Scroll down
>	ENDCASE
>  ENDIF
>  .activatecell(nNewRow,.activecolumn)
>  .DragDropInteractiveChange(oSource, nXCoord, nYCoord, nState)   && Interactive works for DD
>  .refresh
>ENDWITH
This is from a dragdrop grid class, mainly done with purpose dragging from outside of grid onto grid. Implementing this to From inside grid might be more tricky and temporarily placing a transparent shape in front of grid might ease it.
>Cetin


Cetin,

Thanks for the reply. I am draging from outside the grid, so I should be OK. I was looking at the gridhittest, but could not make it work. This code looks like what the gridhittest should/does do. I will try this Monday.

Dean
Previous
Reply
Map
View

Click here to load this message in the networking platform