Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with function keys/keypress event on form
Message
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00688790
Message ID:
00688800
Views:
16
Here is my code around the same problem:
local oObj
	oObj = .activecontrol
	if vartype(m.oObj) == "O" and PEMSTATUS(m.oObj,"DoValid",5)
	   m.oObj.DoValid = .f. && Don't want to fire validation
	endif   
*!*	&& If it's a grid, we need to calculate the active control
*!*			if upper(m.oObj.baseclass) == "GRID"
*!*				nIndex = m.oObj.activecolumn
*!*				for i=1 to m.oObj.columncount
*!*					if m.oObj.columns(i).columnorder = nIndex
*!*						nIndex = i
*!*						exit
*!*					endif
*!*				endfor
*!*				oObj = m.oObj.columns(nIndex)
*!*				oObj = evaluate("m.oObj." + m.oObj.currentcontrol)
*!*			endif

*!*	&& Check if control has different value than its ControlSource
*!*			if !(m.oObj.value==evaluate(m.oObj.controlsource))
*!*	**oObj.setfocus && This is enough to write changes into ControlSource
*!*				m.oObj.value = m.oObj.value && Updated:NN: 06/07/02
*!*			endif
*!*		endif
   
    .cmdProceed.SetFocus() && Updated:NN: 06/07/02
>Hi - i am wanting to assign function keys to various code in my form class so that F1 moves to first record F2 to the previous record etc
>I have got this all working except in one instance. I have a case statement in the keypress of my form class and the keypreview property is set .t.
>
>case nKeyCode == -5 && f6 save
>.mSaveChanges()
>
>The problem is this - if I make changes to text in a textbox and leave the cursor in that textbox then press F6 I loose my changes even though my save routine is getting called - I always seem to loose the changes made to the textbox last edited (the one that the cursor is in when I press F6) - but if I use my save button on the form the changes are saved ok - i have "set confirm on" so I think the problem is that the textbox is not losing focus and the valid not getting called etc. I am not sure how to get it working correctly. Any ideas appreciated!
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform