Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Autocomplete textbox in toolbar
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows NT
Database:
MS SQL Server
Divers
Thread ID:
01226413
Message ID:
01226480
Vues:
17
Aaron,

I don't have VFP9, so I can not test, sorry.

On unrelated note - how can you tell what is the date of this blog entry? When we have references for the blog, I do not see the date of the entry. This one I don't remember reading and I started to read Calvin's blog only recently...

>Here's proof in the pudding of my issue. I have altered Calvin Hsia's demo from (http://blogs.msdn.com/calvin_hsia/archive/2005/08/04/447735.aspx) to demonstrate.
>---
>CLEAR ALL
>
>SET REFRESH TO 2  &&Refresh the BROWSE every 2 seconds
>
>
>CREATE Table AutoComp (Source c(20), Data C(254), Count I, Weight I, Created T, Updated T, User M)
>
>INDEX ON source +UPPER(LEFT(data,30))+padl(count,8) FOR !DELETED() tag data
>
>_screen.AutoCompTable="autocomp.dbf"
>
>
>USE (HOME()+"samples\data\customer")      && use table to get sample data
>
>SCAN NEXT 10
>
>      INSERT into autocomp values ("TXTNAME",Customer.contact,1,0,DATETIME()-1*86400*RECNO(),DATETIME()-2*86400*RECNO(),"")
>
>      INSERT into autocomp values ("TXTCITY",Customer.city,1,0,DATETIME()-3*86400*RECNO(),DATETIME()-4*86400*RECNO(),"")
>
>ENDSCAN
>
>
>
>PUBLIC ox,oBrowse
>
>SELECT 2
>
>USE autocomp order 1
>
>BROWSE NOWAIT NAME oBrowse    && show the autocomp table
>
>
>
>SELECT 1
>
>
>
>CREATE CURSOR temp (name c(30),city c(30))      && temp table for grid
>
>APPEND blank      && add 3 records
>
>APPEND blank
>
>APPEND blank
>
>GO TOP            && go to the first record
>
>PUBLIC oTool as Toolbar
>m.oTool = CREATEOBJECT('toolbar')
>m.oTool.Show()
>m.oTool.AddObject('txtName','Textbox')
>m.oTool.txtName.visible = .T.
>m.oTool.txtName.AutoCompTable = _SCREEN.AutoCompTable
>m.oTool.txtName.AutoComplete = 1
>
>PUBLIC oAutoComp as form
>
>oAutoComp=NEWOBJECT("form")
>
>WITH oAutoComp as Form
>
>      .AllowOutput=.f.
>
>      .Height=400
>
>      .AddObject("lblName" ,"label")
>
>      WITH .lblName
>
>            .Top=10
>
>            .Left=40
>
>            .Caption="Name"
>
>      ENDWITH
>
>      .addobject("txtname","textbox")
>
>      WITH .txtName as TextBox
>
>            .top=10
>
>            .left=90
>
>            .width=200
>
>      ENDWITH
>
>      .AddObject("lblCity" ,"label")
>
>      WITH .lblCity
>
>            .Top=40
>
>            .Left=40
>
>            .Caption="City"
>
>      ENDWITH
>
>      .AddObject("txtcity","textbox")
>
>      WITH .txtCity as textbox
>
>            .top=40
>
>            .left=90
>
>      ENDWITH
>
>      .AddObject("grid1","grid")
>
>      WITH .grid1 as Grid
>
>            .top=80
>
>            .left=30
>
>            .height=100
>
>      ENDWITH
>
>      WITH .grid1.column1
>
>            .AddObject("txtName","textbox")
>
>            .currentcontrol="txtName"
>
>            .width=130
>
>      ENDWITH
>
>      WITH .grid1.column2
>
>            .AddObject("txtCity","textbox")
>
>            .currentcontrol="txtCity"
>
>            .width=130
>
>      ENDWITH
>
>      .AddObject("lst","mylistbox")
>
>      WITH .lst
>
>            .top=210
>
>            .left=20
>
>      ENDWITH
>
>      .SetAll("visible",.t.)
>
>      .Visible=.t.
>
>ENDWITH
>
>
>
>WITH oBrowse as Grid    && position the browse
>
>      .left=oAutoComp.Left+oAutoComp.Width
>
>      .width=650
>
>      .Height=oAutoComp.Height*2
>
>      .FontSize=10
>
>      .AutoFit
>
>ENDWITH
>
>
>
>DEFINE CLASS MyListBox as ListBox
>
>      PROCEDURE init
>
>            WITH this as ListBox
>
>                  .AddItem("None")
>
>                  .AddItem("Alphabetical")
>
>                  .AddItem("Most Frequently")
>
>                  .AddItem("Most Recently")
>
>                  .AddItem("Custom")
>
>            ENDWITH
>
>            this.ListIndex=2  && initialize to Alphabetical
>
>            this.click
>
>      PROCEDURE click
>
>            * change all controls that have Autocomplete property
>
>            thisform.setall("autocomplete",this.ListIndex-1)
>
>ENDDEFINE
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