Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Overwriting value in a combobox
Message
 
À
01/08/2004 13:55:03
Ian Johnston
Computer Software Solutions
Woodland, Californie, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00929987
Message ID:
00929994
Vues:
8
As Sergey mentions, it is not a behavior by default, but if your rowsource is a table, in the Valid event of your combobox you could use something like this (Which checks for an unfound value in the table and asks you if you want to save this value to the table and resets the combo)
If !Empty(This.DisplayValue)
    Local cTableName,cFieldName,nAnswer,cValue
    Store Juststem(This.RowSource) To cTableName &&Won't work for VFP5.0
    Store Justext(This.RowSource) To cFieldName && This is normally used for 3 character extension, but it works for any lenght. Won't work for VFP5.0
    Select (cTableName)
    Locate For &cFieldName = This.DisplayValue
    If !Found()
        nAnswer = Messagebox("This value was not found in the table,"+Chr(13)+"Do you want to save it in the table?",36,"")
        If nAnswer = 6
            Insert Into &cTableName (&cFieldName) Values (This.DisplayValue)
            If CursorGetProp("Buffering") > 1  && Check to see if we should use tableupdate
                Tableupdate(1,.T.,cTableName)
            ENDIF
        this.Requery() && To reset the display value
        Else
            Store '' To This.DisplayValue
        Endif
    Endif
ENDIF
>When the drop down list is open if you highlight the value in the box and try to overtype it will not accept the value you are trying to enter, is this normal behaviour or is there a setting I have missed. I have tried it with selectonentry both ways but get the same action.
>
>Ian
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform