Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

text AutoComplete

Status
Not open for further replies.

jawadfrhad

Programmer
Sep 4, 2017
25
IQ
hi all
this code i put in InteractiveChange...
The code
========
SET SAFETY OFF
SELECT itemname,itemid FROM itemss WHERE ALLTRIM(UPPER(this.value))$ALLTRIM(UPPER(itemname)) INTO CURSOR crs_city
CREATE TABLE MySource (Source C(20),Data C(254),count I,Weight I,Created T,updated T,user M)
INSERT INTO MySource (Source,Data,count,created,updated) ;
SELECT "TXT",; && usually the name of the textbox, the value of AutoCompSource
itemname,; && values from your table
itemid,DATETIME(),DATETIME() from crs_city
USE IN MySource
thisform.text1.AutoComplete= 1
thisform.text1.AutoCompTable="MySource"
thisform.text1.AutoCompSource=ALLTRIM("TXT")
LOCAL nLocID, nValue, llok, cOrder
=========================================
For a problem when you start typing the letter in the text box appear words in the drop down drop down words begin with the letter written
I want the words to appear in the beginning of the written letter and in the center of the written letter and the end of the written letter.
Thanks for the help me

 
Are you creating the AutoComplete table in the InteractiveChange method of the textbox where you want it to appear? That's way too late.

If your goal is to create the AutoComplete table as late as possible, try doing it in the textbox's GotFocus method.

Tamar
 
So you are actually creating the table every time the user hits a key? And then overwriting it with a new table on the next keystroke? That can't possibly be right. Apart from a huge performance hit, you will be losing the very data that you want to save.

If you want a custom auto-complete table, create it at the outset, for example when the app loads, or more likely when you install the app.

Also you need to explain your goal a bit more clearly. I, for one, don't understand "in the text box appear words in the drop down drop down words begin with the letter written:.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Autocomplete (textbox.Autocomplete) modes will never allow you to do that. Even in "User defined weighted order".

Using a combobox you might get there quite simple by using a ComboBox in the default style of 0 (Dropdown combo) will allow the user to type a value like in a textbox or pick a value from the list you specify as RwoSource. Use Rowsourcetype fields and then aliasname.field as RowSource and then in the InteractiveChange event do

Code:
Local lcFiltervalue
lcFiltervalue = This.Value
SET FILTER TO "&lcFiltervalue" $ field IN aliasname

I'll skip the long explanation why to use macro substitution within quotes, it's necessary so the filter expression itself is using a string literal and no variable name which would need to stay in scope, which local variables won't. This.value won't work out for the same scoping reason. The filter expression is not only applied just once when you SET it, so its scope has to be universal and not depend on something else but the expression.

This won't automatically expand the list, but the user can type some letter or letters and then when expanding find the values having these anywhere inside as pickable items. This will only work nice and smooth when your list is short enough.

Bye, Olaf.

Olaf Doschke Software Engineering
 
Thank for All
I think I did not find my cause because the language of Visual FoxPro does not support typing in the textbox and show the word with results
 
If the PDF is too much for you: First of all I think you don't find what you want with autocomplete feature of a TextBox, as the base of what you want is not even a textbox but an EditBox.

The Intellisense features are about either the native Memo editing Window or Editbox, not Textbox and you can use them not only for code but also normal Text and things like a dictionary or text blocks or spelling or word suggestions with "comboboxes" appearing automatically.

If you don't think about texts you might get what you want with textbox autocomplete table designed differently or swapping it out just in time. I doubt that works very seamless, though.

Bye, Olaf.

Olaf Doschke Software Engineering
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top