Thread: Smart text??autofill??

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    20

    Smart text??autofill??

    I want to write something similar to the autofill function in windows (i.e when I type "app" it automatically shows "apple")

    I also need to define a dictionary of some sort, using array maybe, for then above function. how can I do that?

  2. #2
    duck-billed platypus
    Guest
    Ive never tried doing something like that, but what I would do is get a dictoinary file (or create one as the user uses the program like Explorer does, depending on what your using the autofill for), create a large array that acts as an index to your file of words contain all or part of every nth word (you dont want to have to search through the entire file every time the user presses a key!), then as the user types more and more, you can narrow down the choices from your index, then display the choices

    [code]
    your array might look something like this:
    SOME_STRUCT
    dict_index[0] = "abate", 0
    [1] = "amoeba", 55
    [2] = "bark", 98
    [3] = "drain", 143
    .
    .
    .

    then as the user types "app", by searching through your index, you can determine that the 'correct' word must be somewhere between position 55 and position 98, then just display the words that are inbetween those positions, or read in those words and try to narrow down the correct word as the user types in more and more letters.

  3. #3
    duck-billed platypus
    Guest
    Oops, forgot to to [/code], now the indentation is ruined. Oh well

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Which smart pointer to use?
    By leeor_net in forum C++ Programming
    Replies: 4
    Last Post: 04-13-2009, 04:29 AM
  2. smart device database problem
    By mr_empty in forum Windows Programming
    Replies: 1
    Last Post: 01-06-2008, 07:42 PM
  3. Intelligent vs Smart
    By jverkoey in forum A Brief History of Cprogramming.com
    Replies: 17
    Last Post: 07-18-2004, 01:42 PM
  4. Using a smart pointer for all objects
    By phalc in forum C++ Programming
    Replies: 1
    Last Post: 03-28-2004, 09:23 PM
  5. the smart creatures in pacman game
    By Unregistered in forum Game Programming
    Replies: 11
    Last Post: 10-04-2001, 05:22 AM