Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Auto complete entry
Message
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01464082
Message ID:
01464263
Vues:
53
I can run the code as is and play with it. But you just need to use the ideas from it in your form.

Also, why do you need to use this code instead of built-in AutoComplete? All you have to do is to set AutoComplete property of the textbox to true.

>could not get the textbox running - after trying to set it up in new form - a little over my head i think.
>
>I came across this code in http://tek-tips.com/faqs.cfm?fid=6540
>it seems to be what i'm looking for but it breaks down pretty quick after here "Define Class form1 As Form" with error messages:.oform1 is not an object etc. am i wasting my time to try and adapt this?
>
>any help appreciated with thanks
>k
>
>
>
>
>****** VFP9 with SP 1
>Public oform1
>
>oform1=Newobject("form1")
>oform1.Show
>Return
>
>
>**************************************************
>*-- Form:         form1 (\imaginecorp\form11.scx)
>*-- ParentClass:  form
>*-- BaseClass:    form
>*-- Time Stamp:   02/02/07 01:25:12 AM
>*
>Define Class form1 As Form
>
>
>    Top = 3
>    Left = 48
>    Height = 100
>    Width = 375
>    DoCreate = .T.
>    ShowTips = .T.
>    Caption = "Auto Complete"
>    Name = "Form1"
>
>
>    Add Object command1 As CommandButton With ;
>        Top = 67, ;
>        Left = 278, ;
>        Height = 27, ;
>        Width = 84, ;
>        Caption = "Close", ;
>        TabIndex = 2, ;
>        Name = "Command1"
>
>
>    Add Object label1 As Label With ;
>        AutoSize = .T., ;
>        Caption = "Company", ;
>        Height = 17, ;
>        Left = 60, ;
>        Top = 25, ;
>        Width = 55, ;
>        TabIndex = 3, ;
>        Name = "Label1"
>
>
>    Add Object text1 As TextBox With ;
>        Format = "K", ;
>        Height = 23, ;
>        Left = 120, ;
>        SelectOnEntry = .T., ;
>        TabIndex = 1, ;
>        Top = 20, ;
>        Width = 207, ;
>        Name = "Text1"
>
>
>    Procedure Load
>        If Used("customer")
>            Use In customer
>        Endif
>        **** Do not need to do this if there is an Index
>        Set Exclusive On
>        ************************************************
>        Select 0
>        Use Home()+"samples\data\customer.dbf"
>        ************************************************
>        Index On company Tag company
>        Set Order To Tag company
>        ************************************************
>    Endproc
>
>
>    Procedure command1.Click
>        Thisform.Release
>    Endproc
>
>
>    Procedure text1.InteractiveChange
>        With This
>            If (Lastkey() >= 32 And Lastkey() <= 127)
>                .nIDSelStart = Icase(.nIDSelStart >= 0 And Lastkey() = 127,.nIDSelStart - 1,;
>                    .nIDSelStart < 0,0,;
>                    .nIDSelStart + 1)
>                Select customer
>                coldtag = Tag()
>                Set Order To Tag company
>                Locate For Substr(Alltrim(Upper(customer.company)),1,.nIDSelStart) = ;
>                    Upper(Substr(This.Value,1,.nIDSelStart))
>                ***** Could use a SEEK() as well
>                If  Found()
>                    This.Value = customer.company
>                Else
>                    If !Empty(This.Value)
>                        .nIDSelStart = This.SelStart
>                    Else
>                        .nIDSelStart = 0
>                    Endif
>                Endif
>                This.SelStart = .nIDSelStart
>                Set Order To Tag (coldtag)
>            Endif
>        Endwith
>        This.SelLength = Iif(!Empty(This.Value),(Len(Alltrim(This.Value))-(This.nIDSelStart)),1)
>    Endproc
>
>
>    Procedure text1.Init
>        If !Pemstatus(This,"nIDSelStart",5)
>            This.AddProperty("nIDSelStart",0)
>        Endif
>    Endproc
>
>
>Enddefine
>*
>*-- EndDefine: form1
>
>
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform