Information générale
Catégorie:
Codage, syntaxe et commandes
>I do the following to reset the combobox to the top:
>
>In GotFocus:
>THISFORM.cbo_names.ListIndex = 1
>
>The problem is as follows:
>When I am in edit mode and there is already something entered in the combobox and I tab through the box on my way to another form field, the combobox gets filled with the first choice in the dropdown list.
>
>That's fine if you are adding a new record, but in edit mode it doesn't keep the former entry. Is there a workaround for this?
>
>Thanks for the help.
>
>Steve
Steve,
You can check to see if the field has changed before you reset it. Use GETFLDSTATE for this.
nChanged = GETFLDSTATE("fldname")
if nChanged = 2 or nChanged = 4
RETURN DODEFAULT()
ELSE
THISFORM.cbo_names.ListIndex = 1
ENDIF
You could also move your reset statement to a method that you call when a new record is added.
Also, you could reset it only if the ListIndex is blank (ListIndex=0).
Précédent
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