locked
Showing results as they are showing up. Similar to suggested searches when you type into a search engine RRS feed

  • Question

  • Hello, what i am trying to do is similar to what happens when someone searches on a search engine. suggestions pop up as you are typing. i am trying to do the same thing but with contact names.

    Please import first CRV093-1. Save it and add some names to it. 

    this code below is the code used to pop up suggestions, but it seems to only look it up once. I want it to look for names as im typing. Thank you

    path = Program.Directory +"/saved persons/"
    filename = "contacts"
    ext = ".txt"
    getpeople()
    GraphicsWindow.Width= 400
    GraphicsWindow.Height=400
    GraphicsWindow.CanResize="false"
    Controls.TextTyped = lookforperson
    
    createdisplay()
    
    Sub createdisplay
      firstname = Controls.AddTextBox(0,0)
      lasstname = Controls.AddTextBox(0,50)
      instructions = Shapes.AddText("add the (first) name you want to find")
      Shapes.Move(instructions, 160, 0)
      instructions2 = Shapes.AddText("add the (second) name you want to find")
      Shapes.Move(instructions2, 160, 50)
      
      endsub
    
    Sub lookforperson
      TextWindow.WriteLine("Text is being typed")
      
      firstname = Controls.GetTextBoxText(firstname)
      TextWindow.WriteLine(firstname)
      
      For names = 1 To i
        TextWindow.WriteLine(persons[names]["firstname"])
        startswith = Text.StartsWith(persons[names]["firstname"],firstname)
        TextWindow.WriteLine(startswith)
        If startswith = "True" Then
          TextWindow.WriteLine(persons[names]["firstname"])
        Else
         
       EndIf
        
        endfor
      
      
      endsub
      sub getpeople
        i=0
        persons[i] = "1"
    While persons[i] <> ""
      i = i + 1
      persons[i] = File.ReadLine(path+filename+ext,i)
      TextWindow.WriteLine(persons[i]["firstname"] + " " + persons[i]["lastname"] )
      TextWindow.WriteLine(i)
    endwhile
    EndSub
      
      Sub saveperson
      path = Program.Directory +"/saved persons/"
      filename = "contacts"
      ext = ".txt"
      File.CreateDirectory(path)
      
      'File.AppendContents(path+filename+ext, name[i])
    endsub



    Matthew


    • Edited by JetFire3201 Friday, June 17, 2016 6:45 PM Found some errors, First letter works, after that it doesnt work.
    Friday, June 17, 2016 6:39 PM

Answers

  • see ID: VXT021-0

    No extension and could be a full solution to read names (first + last)  from a database, if the read array is in the correct format, like "1=fullName1;2=fullName2;3=...;"

    • Proposed as answer by litdev Sunday, June 19, 2016 1:22 PM
    • Marked as answer by JetFire3201 Monday, June 20, 2016 10:22 AM
    Saturday, June 18, 2016 8:36 PM
    Answerer

All replies

  • How about this?    WTV625   

    Use enter button and search button   (Below photo : Firstname Tom -->  Search.  2 data is obtained )



    Saturday, June 18, 2016 1:00 AM
    Answerer
  • i know how to do that. Thats not new, but what im trying to do is, as im typing the letters, name suggestions come up under the textbox. Like when you type in google or yahoo, as your typing suggestions come up right? Im trying to do that. I know how to save names and make them come up. What im trying to do is make the process look nice and authentic.

    Matthew

    Saturday, June 18, 2016 12:32 PM
  • Perhaps try a search for 'Auto Complete ComboBox or TextBox', from a database or from the filesystem or registry, like in the RunBox or the CreateNewShortcut dialog.

    Here's a very simple idea for SB, using a TextShape or ComboBox from an array. See 'arr' for possible choices. To use a ComboBox, look for roman I. and II.  and  I.) change AddShape() to AddCBox()  and II.) use the appropriate event Subs. ID: VXT021

    Saturday, June 18, 2016 3:08 PM
    Answerer
  • well, i dont want to jst see something thats already created. I want to try to make it myself. And without using litdev's extensions. I would like if it was just core, out of the download programming.

    Matthew

    Saturday, June 18, 2016 4:43 PM
  • well, nothing mentioned above about NOExt, but the version with the TextShape can also be used without extension: just uncomment the LDShapes.BrushColour(...  line (is only cosmetics) and use another event to select eg. an extra button, Mouse- or KeyDown
    Saturday, June 18, 2016 5:15 PM
    Answerer
  • ok but how can i apply that to my version? i cant seem to get that part where it shows up correctly.

    Matthew

    Saturday, June 18, 2016 5:18 PM
  • see ID: VXT021-0

    No extension and could be a full solution to read names (first + last)  from a database, if the read array is in the correct format, like "1=fullName1;2=fullName2;3=...;"

    • Proposed as answer by litdev Sunday, June 19, 2016 1:22 PM
    • Marked as answer by JetFire3201 Monday, June 20, 2016 10:22 AM
    Saturday, June 18, 2016 8:36 PM
    Answerer