Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to get focus off grid during form deactivate?
Message
De
21/11/2008 17:01:45
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01363424
Message ID:
01363580
Vues:
14
Thanks for your reply David. I'm able to remove focus from the control ok, it was just that I needed to continue the focus to go to the new form afterwards.

Anyway, I solved it by putting the code below in the form.Deactivate(). The issue was that VFP sometimes wants to repaint non-sparse grid columns even while focus is on another form. What I mean by repaint, is that my non-sparse column has a container with a textbox and other controls within. I use the textbox.value_assign() method to build items in the container on the fly (timeline bars in this case). Sometimes VFP wants to execute those textbox.value_assign()'s even when focus is on another form. I found that if focus is not on the grid when the form is deactivated and loses focus, VFP behaves itself and doesn't do this. So my code below puts the focus somewhere else on the form before it deactivates.

In case anyone's interested, this is a really neat trick (using the value_assign() of a textbox in a container in a non-sparse column) to build the container for each row of the grid based on that row's table record. Maybe someone's done this before, but I've never seen it mentioned. It would have made a good FoxAdvisor Tip in the good ole days.
Thanks again, Dave! -Mark
LOCAL m.lo1

* ensure focus is not on grid to prevent vfp from repainting non-sparse grid columns
*	while focus is on another form
m.lo1= IIF(TYPE("_screen.activeform") = "O", _screen.ActiveForm, .null.)
IF NOT ISNULL(m.lo1)
	thisform.pgfRent.SetFocus()
	ACTIVATE WINDOW (m.lo1.name)
ENDIF

RETURN DODEFAULT()
>Mark,
>
>You most likely need a NODEFAULT in your method along with an explicit DODEFAULT() call in order to interrupt VFP's native event handling on the control that you want to lose focus.
>
>>Does anyone know a way to change focus to another control on a form - from within that form's deactivate(), and still let the new form get the focus after focus has changed on the deactivated form? Thanks for any ideas! -Mark
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform