Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Objects not updating ControlSource
Message
De
19/09/2001 08:25:59
 
 
À
19/09/2001 05:57:17
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00558218
Message ID:
00558254
Vues:
20
Kev,

One point to note.. If you have a grid which is currently active (and in edit mode) then the activecontrol is the grid not the text box in the grid so Daniels solution needs a bit of tweaking for this situation

I use something like the following in the toolbar button baseclass click code (ie it is run from any toolbar button)
If Type(".ActiveControl") = "O"
Do Case
	Case pemstatus(.Activecontrol, "ActiveColumn", 5)
		If .Activecontrol.Activecolumn > 0
			.Activecontrol.Columns[.Activecontrol.Activecolumn].text1.Setfocus()
		Endif
	Case pemstatus(.Activecontrol, "Setfocus", 5)
		.Activecontrol.Setfocus()
Endcase
Endif
One last point to note with your technique... if you call a form from the toolbar then that toolbar button is disabled until this form is closed.

HTH
Will

P.S. Hi Daniel

>Kev,
>In your toolbar's save() method before the actual code that saves the changes.
>
>>Daniel
>>
>>Where should I put the SetFocus call?
>>
>>Kev
>>>Kev,
>>>The behaviour you see is by design and caused by the fact that toolbars (and menus) don't get focus. Therefore the textbox valid() and LostFocus() don't fire when you click on the toolbar. According HackFox, one way of forcing the valid() to fire is to manually set the focus to the same field:
>>>
>>>_SCREEN.ActiveForm.ActiveControl.SetFocus()
>>>
>>>
>>>HTH
>>>>Hi
>>>>
>>>>My app mainly consists of a Toolbar which talks to the current active form on the app.
>>>>
>>>>If I am in a Textbox and I enter a value, and then click on the Save button in my toolbar - the ControlSource is not updating. I would have thought that as soon as I clicked on the Save button, the Textbox would lose focus and write it's value back to the controlsource.
>>>>
>>>>The only explaination I can think for this is that the Textbox may be losing it's focus, but only because the toolbar has got the focus, but the form still has the textbox as the current focus - am I right in saying that?
>>>>
>>>>Can someone explain this, and if it is what I've said above, what would be the best solution to ensure that Values are written back to the Data?
>>>>
>>>>Thanks
>>>>Kev
Will Jones
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform