Text Fields in XOJO

  1. 3 months ago

    Is it possible to implement something like this Xojo?
    -image-
    -image-
    -image-

  2. Javier M

    Apr 13 Pre-Release Testers, Xojo Pro AprendeXojo - Madrid, Spain

    Sure!

  3. Ian K

    Apr 13 Pre-Release Testers, Xojo Pro

    Why not just use a drop down list / pop up menu.

  4. Roger C

    Apr 13 Lewis Center, OH

    Not clear on exactly what it is you want to do, but have a look at the Formatted Text Control from BKeeney Software

  5. Markus W

    Apr 13 Pre-Release Testers, Xojo Pro #JeSuisHuman Germany, Heidelb...

    @Roger C Not clear on exactly what it is you want to do, but have a look at the Formatted Text Control from BKeeney Software

    How would that help???

  6. Bob K

    Apr 13 Pre-Release Testers, Xojo Pro Kansas City

    @Markus W How would that help???

    I'm curious as well. :)

  7. Alberto D

    Apr 13 Pre-Release Testers, Xojo Pro

    My guess is that OP wants something like a combobox where you can start typing and the drop down automatically change and narrow the options to what is in the box.

  8. Markus W

    Apr 13 Pre-Release Testers, Xojo Pro #JeSuisHuman Germany, Heidelb...

    @Alberto D;Poo My guess is that OP wants something like a combobox where you can start typing and the drop down automatically change and narrow the options to what is in the box.

    I seem to recall someone had one here on the forum as open source …

  9. Louis D

    Apr 13 Pre-Release Testers, Xojo Pro Montreal, QC, Canada

    It is relatively easy to code such restrictions when the process is well defined. Based on the first selection, query a database and fill the second combobox, and so on. The code to fill the second combo box is in a method called by the selection changed event of the first combobox. With an in-memory database, the time lag is minimal. I use this approach in a few applications.

  10. Markus W

    Apr 13 Pre-Release Testers, Xojo Pro #JeSuisHuman Germany, Heidelb...

    The ComboBox has an autocomplete property, so that is what I would use.

  11. Markus W

    Apr 13 Pre-Release Testers, Xojo Pro #JeSuisHuman Germany, Heidelb...

    P.S. Have a read through this thread https://forum.xojo.com/21935-combobox-and-restrict-entry/0

  12. Bill

    Apr 13 Pre-Release Testers, Xojo Pro Longview Texas

    Alberto De Poo: My guess is that OP wants something like a combobox where you can start typing and the drop down automatically change and narrow the options to what is in the box.

    I did this exact thing with a ListBox with a TextField above it. As the user types in the TextField, the LB is repopulated based on the text in the text field. It did perform a SQL Select based on the selection but it was so fast as to not see a delay on a desktop app.

    I have reused this several times....

  13. Michel B

    Apr 13 Pre-Release Testers RubberViews.com

    TextField + ListBox. Simple.

  14. Markus W

    Apr 13 Pre-Release Testers, Xojo Pro #JeSuisHuman Germany, Heidelb...
    Edited 3 months ago

    @BillPlunkett I did this exact thing with a ListBox with a TextField above it. As the user types in the TextField, the LB is repopulated based on the text in the text field. It did perform a SQL Select based on the selection but it was so fast as to not see a delay on a desktop app.

    I have reused this several times....

    Got some code to share? And yes, I can write it myself, I‘m just feeling smart (it’s not lazy if you don’t want to do duplicate work!) …

  15. Bill

    Apr 13 Pre-Release Testers, Xojo Pro Longview Texas

    This code is executed on the KeyUp event of the the TextField. I pass in a trimmed string from the TextField and use it in the select. LBMembers is the list box that is updated...

    Private Sub LoadRSsearch(sStart As String)
      dim i             As Integer
      dim sSQL          As String
      dim sMsg          As String
      Dim sFilter       As String
      
      sFilter = sStart + "%"
      
      sSQL = "SELECT * FROM Members WHERE LastName LIKE '" + sFilter + "' ORDER By LastName"
      
      rsMembers   = dbSQL.SQLSelect(sSQL)
      if dbSQL.Error then
        sMsg = "DATABASE ERROR Reading Members Table, Error: " + dbSQL.ErrorMessage
        MsgBox(sMsg)
        UpdateLog(CurrentMethodName, sMsg, "E")
        Quit
      end if
      if rsMembers = nil then
        sMsg = "No records found on Retrieval"
        MsgBox(sMsg)
        UpdateLog(CurrentMethodName, sMsg, "E")
        Return
      end if
      
      PopulateMembersLB(0)
      
      Return
      
    End Sub
    Private Sub PopulateMembersLB(iRecToSelect As Integer)
      dim i             As Integer
      dim sFirstName    As String
      dim sGoesBy       As String
      dim sLastName     As String
      dim sName         As String
      dim sSQL          As String
      dim sMsg          As String
      dim sMode         As String
      dim sFilter       As String
      dim iSelectRow    As Integer
      dim iCurrentKey   As Integer
      
      if bFiltered then 
        sFilter = "Custom Filter"
      else
        sFilter = "None" 
      end if
      
      lblRecords.Text = "Members Displayed:  " + str(rsMembers.RecordCount )
      lblFilter.Text = "           Filter:  " + sFilter
      rsMembers.MoveFirst
      
      lbMembers.deleteAllRows
      
      i = 0
      while not rsMembers.eof
        
        ICurrentRecord = rsMembers.Field("pkRecID").IntegerValue
        iCurrentKey    = ICurrentRecord
        sFirstName     = rsMembers.Field("FirstName").StringValue
        sGoesBy        = rsMembers.Field("GoesBy").StringValue
        if sFirstName <> sGoesBy then
          sFirstName = rsMembers.Field("FirstName").StringValue + "  '" + sGoesBy + "'" 
        end if
        sLastName      = rsMembers.Field("LastName").StringValue
        sName          = sLastName + ", " + sFirstName
        
        lbMembers.addRow
        lbMembers.RowTag(i)    =rsMembers.Field("fkMemberID").IntegerValue
        lbMembers.cell( i, 0 ) = sName
        
        if rsMembers.Field("pkRecID").IntegerValue = iRecToSelect then
          iSelectRow = i
        end if
        
        i = i + 1
        rsMembers.MoveNext
      wend
      
      if iRecToSelect > 0 then
        lbMembers.ScrollPosition = iSelectRow
        lbMembers.selected(iSelectRow) = true
      end if
      
      
      Return
    End Sub
  16. Emile S

    Apr 14 Europe (France, Strasbourg)

    @Markus W The ComboBox has an autocomplete property, so that is what I would use.

    Either I do not saw that Property / Not read that entry / Not understand / Whatever: I never implemented it.

    I just enabled that property, and it worked fine.

    Unfortunately, something went wrong:the selected entry do not goes into the ROWTAG feature (the AutoCompleted Row is not the one who have a RowTag). So, useless as is.

    To really implement something useful, I have to take the resulting text, then search the .Text Row, then go thru its .RowTag property (to have the Unique ID of the wanted RecordSet, etc.).

    Yes, a bit strange.

    I will read Bill shared Code, but I think I will set .AutoComplete back to False.

    Even my current implementation is not Rock Solid (returns some MsgBox Errors if the entry is incomplete: nothing found in the DB). :(

  17. Tim H

    Apr 14 Pre-Release Testers Portland, OR USA

    You don't get a valid ListIndex value?

  18. Emile S

    Apr 15 Europe (France, Strasbourg)

    @Tim H You don't get a valid ListIndex value?

    No, because the AutoCompleted text appears in the ComboBox’ Edit Row, not in its own entry (as far as I can understand).

    I was curious to try that feature. Definitively do not works as a PopupMenu (no auto complete there, but you go to the real Row)…

    Thanks Tim.

or Sign Up to reply!