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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Olecontrol keep fires keydown "Enter" for twice

Status
Not open for further replies.

koklimabc

Programmer
Jun 17, 2013
49
MY
Dear all,

I hope someone could guide me me up where I've problem to deal with keydown event of dtpicker(olecontrol). I just want to switch focus on control_1 after press in 'Enter' button but it just return to control_2. 'nodefault' is not working at all.

add object dtpicker as olecontrol with ;
oleclass= "MSCOMCTL2.DTPICKER.2",;
top = 10,;
left = this.width - this.width/2,;
width = 95,;
height = 24

procedure dtpicker.keydown
LPARAMETERS keycode, shift
if keycode = 13
Nodefault => this is not working to avoiid 2 times Enter pressed.
this.parent.control_1.setfocus() => It will soonly switch focus to control_2 right after control_1.
endif
endpro

Thanks to someone could help.
 
Look into the when and gotfocus events of ontrol_1.
Also: if control_1 is not enabled, focus automatically moves next.

NODEFAULT should work, the reason for the behaviour most probably is not that.

Besides, read the help topic on _vfp.autoyield

Bye, Olaf.
 
NODEFAULT doens't work with ActiveX controls. It's for VFP controls only.

VFP Help topic for NODEFAULT said:
Prevents Visual FoxPro from performing its default event or method processing for Visual FoxPro events and methods.

(Emphasis added.)

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
You can try procedure dtpicker.keyup() (not tested)


Respectfully,
Vilhelm-Ion Praisach
Resita, Romania
 
Yea, agree with Mike Lewis,

I've found solution by setting keypreview = .t. under form and defined nodefault for nKeycode = 13 to disable all type of "Enter" keypress event.Therefore,it worked.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top