Information générale
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
ToolBar - Problem solved
I had a problem when using a Toolbar in a Formset and have since solved the problem. Perhaps someone has a better solution but here is how I solved the problem.
This is passed on so that all can benefit.
When using a Formset with a Toolbar, problems will occur if you are using "Buffering,3"
If you navigate using the toolbar without first tabbing out of the field the data entered will not be saved to the record. It appears that the toolbar is not really part of the form and therefore when you click a toolbar item the field that you were in does not loose focus.
This becomes more problematic if you are using a ComboBox.
For anyone having this problem the following should help.
* Create a proceedure in the FormSet ... lInteractivechange
* Put this in the InteractiveChange method of the controls
THISFORMSET.lInteractivechange=.T.
* Put this in the click event of any Nav. Button in your Toolbar
LOCAL TextVal
IF THISFORMSET.lInteractiveChange
THISFORMSET.lInteractiveChange = .F.
WITH THISFORMSET.ACTIVEFORM.ACTIVECONTROL
DO CASE
CASE INLIST(.BASECLASS, 'Textbox', 'Editbox')
.VALUE = .VALUE
CASE INLIST(.BASECLASS, 'Combobox')
TextVal = .TEXT
.VALUE = TextVal
.VALID()
.DISPLAYVALUE = TextVal
ENDCASE
ENDWITH
ENDIF
* If you are using a ComboBox the following is required:
* Put this in the GotFocus Event of the ComboBox
combofocus="thisformset.form1.mycombobox."
* Put this in the LostFocus Event of the ComboBox
combofocus=" "
* Put this in the click event of the Nav. Button
IF combofocus>" "
&combofocus.VALUE=&combofocus.DISPLAYVALUE
nresult=TABLEUPDATE(1)
&combofocus.REQUERY
ENDI
This gets even more complicated if you have Valid Events in your fields:
If you try to navigate without first tabbing out of the field with a Valid Event the Valid Event will not fire.
My solution was to create a Method "CheckValues" in the Formset and placed a duplicate of my valid code in "CheckValues" and called CheckValues from the Click event prior to navigation.
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement