Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Selecting values in cbofill combobox
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
Selecting values in cbofill combobox
Divers
Thread ID:
01203779
Message ID:
01203779
Vues:
63
I am using one of the class I found on this site (Marcia Atkins posting) called cboqfill to incrementally search for values. My problem is I need to make sure that only the values populated in the cboqfill combobox are allowed to be selected and no other value can be typed or choosen in the combobox. Currently, a user can type any value, how can I make sure only values popuated in combobox can be choosen.

here is the class that Marcia Atkins show in one of the postings:
*-- Class:        cboqfill 
Define Class cboqfill As combobox

  SelectOnEntry = .T.
  Style = 0
  coldexact = ""
  Name = "cboqfill"


  Procedure handlekey
    Local lcSofar, lnSelStart, lnSelLength, lnRow

    With This
      *** Handle backspace key
      If Lastkey() = 127
        .SelStart = .SelStart - 1
      Endif
      *** Get the value typed in so far
      lnSelStart = .SelStart
      lcSofar =  Left( .DisplayValue, lnSelStart )
      *** Find a match in column #1 of the combo's internal list
      For lnRow = 1 To .ListCount
        If Upper( .List[ lnRow, 1 ] ) = Upper( lcSofar )
          .ListIndex = lnRow
          Exit
        Endif
      Endfor
      *** Highlight the portion of the value after the insertion point
      .SelStart = lnSelStart
      lnSelLength = Len( Alltrim( .DisplayValue ) ) - lnSelStart
      If lnSelLength > 0
        .SelLength =  lnSelLength
      Endif
    Endwith
  Endproc


  Procedure LostFocus
    If This.coldexact = 'ON'
      Set Exact On
    Endif
  Endproc


  Procedure GotFocus
    With This
      .uOldVal = .Value
      ComboBox::GotFocus()
      This.SelStart = 0
      This.SelLength = Len( This.Text )
      .coldexact = Set( 'EXACT' )
      Set Exact Off
      Nodefault
    Endwith
  Endproc


  Procedure InteractiveChange
    *** handle the key...IOW, find the closest match in the list
    If This.SelStart > 0
      If ( Lastkey() > 31 And Lastkey() < 128 ) Or ( Lastkey() = 7 )
        This.handlekey()
      Endif
    Endif
  Endproc


Enddefine
I am setting the rowtypesource to Fields and rowsource a view field called lv_institution.i_instname.


thanks
Nick Patel
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform