×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

How to search and return all possible result as yout type?
2

How to search and return all possible result as yout type?

How to search and return all possible result as yout type?

(OP)
Hi everyone, im still enhancing my project... i have a combobox used with seek and if found() that you could search through scrolling the list, and clicking once you have found your search, my question is, is it possible to search by typing for example surname and returns possible searches while you tpe the letter? If so, please help me how to do it or show example that I coud base on? Thanks in advance...

RE: How to search and return all possible result as yout type?

The simplest is to set combobox.incrementalsearch=.t. and no code at all. The combobox then does react to what you type while it has focus, as long as you type fast enough. What is taken as start of the name you search, is everything you type with pauses shorter than .5 seconds, which is set in the _INCSEEK system variable (so you can also make it higher for people typing slower).

The _INCSEEK maximum pause time means that if you type MA to search for names starting with MA, but need more than _INCSEEK seconds between M and A, the search does not look for MA but for A. Or in other words, when you make a longer pause than _INCSEEK while typing, this means you start a different search.

Also important: This works for combobox.Style=2 (dropdown list) mainly, when the combobox is a dropdown list. With Style 0 you have a combination of a textbox with an item list and what you type simple goes into the textbox portion of this combined control and causes no incremental search, unless you FIRST expand the list and then type.

On the other hand, with the Style 0 (dropdown combo) you could use what you have with SEEK (when you also have SET NEAR ON to find the nearest match).

Does that help, or do you struggle with displaying the list while the user searches? There also is an example how to do all that in the solutions.app of VFP called "Allow users to choose list values", a solution about the combobox.

Chriss

RE: How to search and return all possible result as yout type?

Mandy,

Chris has given you a good answer - and the one that I would go for as well.

However, there is another option for you to consider. Instead of a combo box, use a textbox, and set its AutoComplete property to 1. Then, as you type each character, you will see a drop-down list containing all the entries you have previously made in that control which match the characters entered so far. You will then be able to select one of those entries without having to type the rest of it.

The main difference between this method and a combo box is that a combo box lets you select from a pre-determined list, such as an existing lit of customers, whereas the textbox method lets you enter any text - and will save that text for future use. (I mean that it saves it within the AutoComplete list, not that it saves it in a database.)

This might not be want you want, but I thought I would mention it for you to consider - either now or for some future requirement.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: How to search and return all possible result as yout type?

Mandy, Mike

the autocomplete textbox is a usable alternative, correct. I'd prefer a fixed list for picking, but indeed you can also define the autocomplete data and set it up to not store further new texts typed in. It's just not as easy as with a combobox.

I still prefer the combobox dropdown list for that reason. The UI is more guiding, since you see a dropdown button you see there is a dropdown list, the textbox with autocomplete feature only shows that list when you begin typing. Ok, it may be early enough to understand it and only is an issue for a first time users hesitating what to type in without knowing a list of values to pick from. Whether you would hesitate also depends on what input the control wants from the user. If you ask for an address, nobody would expect or even welcome a dropdown list of streets or zip codes. Though in the case of zip codes it would help to guarantee only valid existing zip codes are entered.

If you want to use the autocomplete feature, you have to understand some implications. For a starter you could simply set Autocomplete=1 and see what happens. But you'd not easily get it controlled by a predefined list. a DBF is created and where that is and whether that will be a DBF per user or for all users will depend, so it's not the easiest option, that surely is simply setting incrementalsearch to .T.

Chriss

RE: How to search and return all possible result as yout type?

Mandy - in the example screen shots I showed you from MaxFrame, the grid on the list page will do what you want. You just click on the last name column header, to put it in order by lastname. In fact, my approach lets you put the grid in LastName, FirstName order, so you could enter "Smith, J" and see Jack, James, Jill.

I't sorry to see you struggling to invent a stone wheel when a brand new modern tire is available for free.

Mike Yearwood - Former Microsoft Visual FoxPro MVP award winner. TWICE

RE: How to search and return all possible result as yout type?

(OP)
Thanks myearwood... ok, I'll try to study more...

Mike and Chriss Thanks so much... my app is now working well with these solutions and tips that you have given... god bless....

RE: How to search and return all possible result as yout type?

Mandy - please show a couple of your screens from your system. Hide any student information. I will give you a MaxFrame application done with my user interface and show you how to build the rest.

Mike Yearwood - Former Microsoft Visual FoxPro MVP award winner. TWICE

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close