Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ENTER (if you dare!!!)
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01161171
Message ID:
01161205
Views:
12
That worked in the test form, but not in the form I am working on. Here is more information....

This is the code in the Keypress Event of the txtDrugFilter textbox
LPARAMETERS nKeyCode, nShiftAltCtrl
LOCAL lcFilter, lcSetExact

lcSetExact = SET('EXACT')

IF THISFORM.m_DataKeyPress(nKeyCode,.F.)
	SET EXACT OFF

	IF THISFORM.p_viewtype = 1
		SELECT refill
		SET FILTER TO INLIST(STATUS,0,1,4,5)	&& 4 Included so batch Rx's cant be refilled

		SET EXACT OFF
		lcFilter = IIF(NOT EMPTY(THISFORM.p_buffer),;
			THISFORM.p_previousdrugfilter + " AND UPPER(drug.name) = '" + ;
			ALLTRIM(UPPER(THISFORM.p_buffer)) + "' IN Rx",;
			THISFORM.p_previousdrugfilter + " IN Rx")
		SET FILTER TO &lcFilter
		GO TOP IN rx
	ELSE
		SELECT refill
		SET FILTER TO
		SELECT rx

		SET EXACT OFF
		lcFilter = IIF(NOT EMPTY(THISFORM.p_buffer),;
			"UPPER(drug.name) = '" + ;
			ALLTRIM(UPPER(THISFORM.p_buffer)) + "' IN Rx","")
		SET FILTER TO &lcFilter
		GO TOP IN rx
	ENDIF
	THISFORM.grdProfile.REFRESH()

	SET EXACT &lcSetExact
	*THISFORM.REFRESH
ENDIF
And here is the THISFORM.m_DataKeyPress event code....
LPARAMETERS nKeyCode, llSearchNumbersOnly
LOCAL llRecJump

llRecJump = .F.
DO CASE
CASE nKeyCode = 3							&& Ctrl + C
	THISFORM.p_Buffer = ""
	THISFORM.cntActions.txtDrugFilter.VALUE = ""
CASE nKeyCode = 13							&& Enter
	NODEFAULT 
	THISFORM.grdProfile.SETFOCUS
CASE nKeyCode = 32							&& Space
	THISFORM.p_Buffer = THISFORM.p_Buffer + " "
	llRecJump = .T.
CASE (nKeyCode = 7) OR (nKeyCode = 127)		&& Backspace or Del
	IF LEN(THISFORM.p_Buffer) > 0
		THISFORM.p_Buffer = LEFT(THISFORM.p_Buffer,(LEN(THISFORM.p_Buffer) - 1))
		llRecJump = .T.
	ENDIF
CASE BETWEEN(nKeyCode,33,126)				&& Printable chars
	IF BETWEEN(nKeyCode,48,57)				&& 0 - 9
		THISFORM.p_Buffer = THISFORM.p_Buffer + CHR(nKeyCode)
		llRecJump = .T.
	ELSE
		IF !llSearchNumbersOnly
			THISFORM.p_Buffer = THISFORM.p_Buffer + CHR(nKeyCode)
			llRecJump = .T.
		ENDIF
	ENDIF
ENDCASE

RETURN llRecJump
Maybe this will help.

I will continue to check the properties of the txtDrugFilter and the grdProfile.

Thanks!

>Tommy,
>
>I just created a form, put 3 textboxes on it and then a grid. In the first textbox this code works as you want:
>
>
>LPARAMETERS nKeyCode, nShiftAltCtrl
>
>if nKeyCode = 13
>   nodefault
>   thisform.grid1.SetFocus()
>endif
>
>
>>I added that, with the same results. When I press the Enter key when in the txtDrugFilter textbox, the grdProfile blinks and the focus is regained in the txtbox.
>>
>>Let me go check the behavior of the form in general to be sure there is not some code there causing this behavior.
Tommy Tillman A+ NetWork+ MCP
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform