Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Conditional changing of Mouse Pointer on a Grid
Message
From
26/09/2005 04:05:55
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows 2000 SP4
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01046136
Message ID:
01052933
Views:
11
>>>Hi !
>>>
>>>I want to change the Mouse Pointer on a Grid, which are bases on some conditions.
>>>
>>>i.e
>>> I'v a grid with 5 columns and there is some numeric values over there. I want to change the mouse pointer when I move my mouse on the '0' zero values.
>>>
>>>Thanks in advance
>>>Ravi Mehrotra
>>
>>
>>* add this into the grid class
>>PROC Mousepointer_Access
>> return nExpression
>>
>
>Hi Fabio,
>How does adding this procedure allow one to change the mousepointer? I'm hoping for the same solution. The difficulty I'm having is if the grid is not highlighted, the mousemove events don't trigger.
>Allen

This is a simple grid improvement without adding hundreds of things.

Run this, and move the mouse over the grid rows, one by one,
the mouse pointer change with a cyclic rule.
PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.Show
RETURN

DEFINE CLASS form1 AS form
	Height = 400
	ADD OBJECT grid1 AS myGrid WITH ;
		Height = 350, ;
		Left = 34, ;
		Top = 5, ;
		Width = 320, ;
		Name = "Grid1",;
		MousePointer = 99 && with 99 customMousePointer is called,
                                  && by default it is invariant and return 99

	PROCEDURE Load
		CREATE CURSOR XX1CB (F1 I,F2 V(40))
		FOR N=100  TO 0 STEP -2
			INSERT INTO (ALIAS()) (F1,F2) VALUES(m.n,'Item n°'+sTR(m.n))
		ENDFOR
		LOCATE
	ENDPROC

	PROCEDURE Grid1.customMousePointer(nWhere,nRelRow,nRelCol)
		RETURN IIF(m.nWhere=3,m.nRelRow%17,0)  && put a mousepinter rule here
ENDDEFINE


DEFINE CLASS myGrid AS Grid

   HIDDEN PROCEDURE MousePointer_Access
      IF m.This.MousePointer = 99 && for a custom put a dynamic level
	 LOCAL nWhere,nRelRow,nRelCol
	#IF VERSION(5)<900
	   =grid::GridHitTest(MCOL(m.thisform.name,3);
                             ,MROW(m.thisform.name,3);
			     ,@m.nWhere,@m.nRelRow)
	#ELSE
           =grid::GridHitTest(MCOL(0,3),MROW(0,3),@m.nWhere,@m.nRelRow,@m.nRelCol)
	#ENDIF
	RETURN this.customMousePointer(m.nWhere,m.nRelRow,m.nRelCol)
      ENDIF
      RETURN m.This.MousePointer
ENDPROC
	
PROCEDURE customMousePointer(nWhere,nRelRow,nRelCol)
   RETURN 99
	
ENDDEFINE
This is a sample with MouseIcon dynamic:
PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.Show
RETURN

DEFINE CLASS form1 AS form
   Height = 400
	
   ADD OBJECT grid1 AS myGrid WITH ;
	Height = 350, ;
	Left = 34, ;
	Top = 5, ;
	Width = 320 ;
	,MousePointer = 99 && WITH 99 customMousePointer is called, by default it return 99
		
   PROCEDURE Load
	CREATE CURSOR XX1CB (F1 I,F2 V(40))
	FOR N=100  TO 0 STEP -2
		INSERT INTO (ALIAS()) (F1,F2) VALUES(m.n,'Item n°'+sTR(m.n))
	ENDFOR
	LOCATE
ENDPROC

PROCEDURE Grid1.customMousePointer(nWhere,nRelRow,nRelCol)
	* change the pointer
	this.MouseIcon = HOME(4);
             +IIF(m.nRelRow%2=0,"Icons\Flags\CTRFRAN.ICO","Icons\Flags\CTRITALY.ICO")
	RETURN 99
ENDDEFINE

DEFINE CLASS myGrid AS Grid

  HIDDEN PROCEDURE MousePointer_Access
	IF m.This.MousePointer = 99 && for a custom put a dynamic level
		LOCAL nWhere,nRelRow,nRelCol
		#IF VERSION(5)<900
			=grid::GridHitTest(MCOL(m.thisform.name,3),MROW(m.thisform.name,3);
				,@m.nWhere,@m.nRelRow,@m.nRelCol)
		#ELSE
			=grid::GridHitTest(MCOL(0,3);
                                          ,MROW(0,3),@m.nWhere,@m.nRelRow,@m.nRelCol)
		#ENDIF
		RETURN this.customMousePointer(m.nWhere,m.nRelRow,m.nRelCol)
	ENDIF
	RETURN m.This.MousePointer
   ENDPROC
	
   PROCEDURE customMousePointer(nWhere,nRelRow,nRelCol)
      RETURN 99

ENDDEFINE
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform