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

VFP5 To VFP6 behaviour change

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi,

I have an applicaion that is running fine with VFP5. When I compiled it in VFP6, I found one strange behaviour. I have a form that has some input fields and a few command buttons. Every input field calls a function in its valid event. Based on certain conditions, this function sets the 'Default' property of one of the command button either true or false. In VFP5 compiled application, if I hit enter on one input field, it goes to next input field. In VFP6 compiled application, if I hit enter, it just stops there in the same field. If I comment those lines that change the default property value, then this program works fine. Could someone please explain what is going on. Thanks.
 
Hi!

Default property change can cause unpredictable results on the form. It seems this property was designed to be one and only one for the form. If you want that behavior correct, instead of using the Default property changing it just set the KeyPreview property of the form to .T. and handle Enter key (code 13) in the KeyPress event of the form. For example:

if nKeyCode = 13
if {certain condition}
thisform.Button1.Click
nodefault
else
if {certain condition2}
thisform.Button2.Click
nodefault
endif
endif
endif
Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top