Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
MulitSelect Grid
Message
De
16/09/2001 16:03:41
Scott Butts
Ims Specialty Services
Twin Falls, Idaho, États-Unis
 
 
À
16/09/2001 12:21:32
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00556981
Message ID:
00557075
Vues:
20
This message has been marked as the solution to the initial question of the thread.
I knew I had to do something else here is the code I used in the mousedown method. You have to add a few properties. Hope this helps.
LPARAMETERS nButton, nShift, nXCoord, nYCoord
local lcSelector,lnElapsedTime

* 11-07-2000 SEB
* Added so that this calss would be able to process 
* the DBLClick event.  The elapsed time from the last
* click is checked and it has to be a left click with
* not modifier keys.  The last check, lselected makes
* sure that this just isn't a quick click in a nother
* row of the grid but that it is a dblclick on an
* already selected rowed.
lnElapsedTime   = SECONDS()-THIS.nLastClick
if lnElapsedTime < _DBLClick and ;
	!this.lInKeyPress and ;
	nButton = 1 and ;
	nShift = 0 and ;
	lselected
	nodefault
	this.dblclick()
	return
endif
lcSelector = this.parent.parent.recordsource
if nButton = 1
	nodefault
	nCurrec = recno()
	do case
		case nShift = 1 
			* Find start point
			replace lSelected with .f.  ;
					for lSelected
			go nCurrec
			replace lSelected with .t.
			mKey = key()
			mCurValue = iif( !empty(order()), eval(mKey), 0)
			if !seek(.t.,lcSelector,"lLstSeld")
				go nCurrec
	 			replace lLastSelected with .t.
			endif
			mLastValue = iif( !empty(order()), eval(mKey), 0)
		    if mCurValue = mLastValue
			   	nStart 	= min(nCurrec,recno())
			   	nStop	= max(nCurrec,recno())
			else
			    nStart	= iif(mCurValue < mLastValue,nCurrec,recno())
			    nStop	= iif(mCurValue < mLastValue,recno(),nCurrec)
		    endif
			go nStart
			replace while recno() # nStop ;
				lSelected with .t.
			go nStop
			replace lSelected with .t.
			go nCurrec
		case nShift = 2
			replace lSelected with !lSelected
		otherwise
			replace lSelected with .f.,  ;
				lLastSelected with .f. ;
				for lSelected
			go nCurrec
			replace lSelected with .t.,  ;
				lLastSelected with .t.
	endcase
	this.setfocus
endif	
this.parent.parent.onselection()
* 11-07-2000 SEB
* Added so that this calss would be able to process 
* the DBLClick event
THIS.nLastClick = seconds()
Here is the changes I made to the Keypress method
LPARAMETERS nKeyCode, nShiftAltCtrl
PRIVATE m.nElapsedTime

m.nElapsedTime   = SECONDS()-THIS.nLastPress
* 11-07-2000 SEB
* Added so that this calss would be able to process 
* the DBLClick event if not called from keypress
this.lInKeyPress = .t.
IF nKeyCode = 32   && Select with ctrl+click
	NODEFAULT
	this.mousedown(1,2)
* 11-07-2000 SEB
* Added so that this calss would be able to process 
* the DBLClick event if not called from keypress
	this.lInKeyPress = .f.
	return
ENDIF
IF inlist(nKeyCode,56,50) and nShiftAltCtrl = 1
	NODEFAULT
	this.parent.parent.shiftstate = .t.
	this.mousedown(1,1)
	KEYBOARD iif(nKeyCode = 50,"{CTRL+DNARROW}","{CTRL+UPARROW}")
* 11-07-2000 SEB
* Added so that this calss would be able to process 
* the DBLClick event if not called from keypress
	this.lInKeyPress = .f.
	return
ENDIF
IF !empty(this.tagname)
	DO CASE
		CASE BETWEEN(m.nKeyCode, 48, 126)	;
			or inlist(m.nKeyCode,199,221,222,208,220,214,231,240,246,252,253,254) && Turkish fix
			NODEFAULT
			cUpCase = UPPER(chrtran(CHR(m.nKeyCode),"iy_d","YI_D"))  && Turkish fix
			this.cSearchString=;
				IIF(m.nElapsedTime>_DBLCLICK, ;
					cUpCase, THIS.cSearchString+cUpCase)
			nCurrec = recno()
			IF !SEEK(UPPER(THIS.cSearchString),;
					THIS.Parent.Parent.RecordSource,this.tagname)
				GO nCurrec
			ENDIF
			this.mousedown(1,0)
		CASE m.nKeyCode=127					&& Backspace
			NODEFAULT
			IF LEN(THIS.cSearchString)<1 OR ;
					m.nElapsedTime>_DBLCLICK
				this.cSearchString = ""
				IF SET("BELL")="ON"
					?? CHR(7)
				ENDIF
			ELSE
				this.cSearchString=LEFT(THIS.cSearchString, ;
					LEN(THIS.cSearchString)-1)
				nCurrec = recno()
				IF !SEEK(UPPER(THIS.cSearchString),;
					THIS.Parent.Parent.RecordSource,this.tagname)
					GO nCurrec
				ENDIF
				this.mousedown(1,0)
			ENDIF
		CASE m.nKeyCode=7
			NODEFAULT
	ENDCASE
	this.nLastPress=SECONDS()
ENDIF
* 11-07-2000 SEB
* Added so that this calss would be able to process 
* the DBLClick event if not called from keypress
this.lInKeyPress = .f.
I think that is all I changed. Let me know if this works for you.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform