Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Tip of the Day --- Focus Gotcha
Message
De
09/09/1999 18:40:59
 
 
À
09/09/1999 08:33:08
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00262794
Message ID:
00263186
Vues:
24
Hi John,
I note with interest the reply from Jeff Pace. I'll be looking into that for sure.
I use the setfocus() approach as originally put forward by Jim Booth in '97 ( see what good documentation does :-), however his approach failed on grids (at least it did in VFP3) where i used the following mod. I think this problem partially convinced Jim never to use grids for editing. But we had great success once this code was in place.
* according to Jim Booth, Foxtalk Apr 97, 
* with Grid detection modification by David Bower
IF TYPE("thisform.ActiveControl.Name") = "C"
	LOCAL oC, oAC		&& any control and Active Control
	oAC= thisform.ActiveControl
	IF oAC.Baseclass = "Grid"
		LOCAL nColumn, cControl
		nColumn= oAC.ActiveColumn
		IF BETWEEN(m.nColumn, 1, oAC.ColumnCount)
			oC= EVALUATE("oAC.Columns(nColumn)." + oAC.Columns(m.nColumn).CurrentControl)
			oC.SetFocus()
		ENDIF
	ELSE
		oAC.SetFocus()
	ENDIF
ENDIF
You see the currentcontrol of the grid needs to get the set focus not the activecontrol of the form. I suspect the same logic might apply to Jeff's approach.


>Hi all ---
>
>Many of y'all know this one but many more might not. I had forgotten it and it bit me in the butt with a client:
>
>When calling a Save routine from a Toolbar button or Menu option, the changed data in the current control may not be saved. Why? Because the Control never really loses focus and, therefore, the underlying ControlSource is not updated with the new Value.
>
>The trick is to force a LostFocus. A good way to do that is to SetFocus() to an OK button or other non-databound control in the same Form.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform