Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Do Form in Valid Event.

Status
Not open for further replies.

andreateh

Programmer
Jul 19, 2003
83
SG
In the Valid event of a textbox i put code below :
Code:
IF EOF("t_ireqd") AND EMPTY(t_ireqd.procod) AND;
   LASTKEY() = 13
	SELECT t_ireqd
	APPEND BLANK
	oapp.doform("bhpurinb",thisform.DataSessionId)
ENDIF

The LASTKEY() = 13 is try avoid the form popup if user is in the textbox and then user use the mouse click on other control.

I press "ENTER" key in the login form. Then i lunch the parent form from menu by using mouse.
After i lunch this parent form from menu. I click on the textbox. And then i click on other control. The problem is after i perform action above the lastkey() alway return 13. Except i type some thing in the textbox then the lastkey in the value of the chracter i type in the textbox. Can anyone help me ?
 
I press "ENTER" key in the login form.
The problem is after i perform action above the lastkey() alway return 13.

Isn't ENTER (value 13) the last key you did use?

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
[italic]Isn't ENTER (value 13) the last key you did use?[/italic]
So is it possible to clear this value ?
 
andreateh

LASTKEY() returns the value of the lastkey used. So in order to change this value, just issue a Keyboard. Here is an example, if you click on the lastkey result button first you most likely will get 13, but if you click on the Backspace button and then the lastkeyyou will get a 127. Copy the following in a program and run it.
Code:
PUBLIC oform1
oform1=NEWOBJECT("form1")
oform1.Show
RETURN
DEFINE CLASS form1 AS form
	DoCreate = .T.
	Caption = "Form1"
	Name = "Form1"
	ADD OBJECT command1 AS commandbutton WITH ;
		Top = 120, ;
		Left = 132, ;
		Height = 27, ;
		Width = 84, ;
		Caption = "Lastkey result", ;
		Name = "Command1"
	ADD OBJECT command2 AS commandbutton WITH ;
		Top = 72, ;
		Left = 132, ;
		Height = 27, ;
		Width = 84, ;
		Caption = "Backspace", ;
		Name = "Command2"
	PROCEDURE command1.Click
		MESSAGEBOX(TRANSFORM(LASTKEY()))
	ENDPROC
	PROCEDURE command2.Click
		KEYBOARD '{BACKSPACE}' 
	ENDPROC
ENDDEFINE


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top