Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Combo Box - problem when keying in answer not selecting
Message
De
22/05/1999 09:48:59
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00221566
Message ID:
00221737
Vues:
14
>Cetin, thanks for the help. I'm very close to my solution
>thanks to you. One last question. It remains on screen now
>except when i go through a field later where I use the
>command "thisform.refresh". Then the combo box info I keyed
>in still goes away. Any Idea would be appreciated.
>Thanks again.
>
>Brad Trim
>Birmingham, Alabama
Brad,
Try with this class :
**************************************************
*-- Class:        cmbself_edit (d:\vfpclasses\global.vcx)
*-- ParentClass:  combobox
*-- BaseClass:    combobox
*
DEFINE CLASS cmbself_edit AS combobox
  Height = 22
  Width = 100
  DisabledBackColor = RGB(255,255,255)
  aliasname = "None"
  fieldname = "None"
  Name = "cmbself_edit"

  PROCEDURE GotFocus
  this.REQUERY			        && Do we have new elements ?
  this.value = eval(this.controlsource)	&& Reposition
ENDPROC


  PROCEDURE InteractiveChange
  *
  * Self note : Restudy this code
  *
  *This.displayvalue = ;
  * Chrtran(This.displayvalue,"ýi","IÝ") && Local language fix
  WITH this
    IF .selstart = 0
      RETURN
    ENDIF
    cPos = .selstart
    IF lastkey() = 127 && Backspace
      IF .selstart = 1
        .displayvalue = ""
        .selstart = 0
        .sellength = 0
        RETURN
      ENDIF
      cCheckValue = left(.displayvalue,.selstart-1)
      cPos = cPos - 1
    ELSE
      cCheckValue = iif(cPos = 1,"",left(.displayvalue,cPos-1))+chr(lastkey())
    ENDIF
    lExistsOne = .f.
    FOR ix = 1 to .listcount
      IF  Upper(Alltrim(.list(ix))) = upper(alltrim(cCheckValue))
        .displayvalue = .list(ix)
        lExistsOne = .t.
        EXIT
      ENDIF
    ENDFOR
    .selstart = cPos
    IF lExistsOne         && Available item
      .sellength = len(.displayvalue) - cPos
    ELSE
      .sellength = 0
    ENDIF
  ENDWITH
ENDPROC


  PROCEDURE LostFocus
  *This.displayvalue = ;
  * Chrtran(This.displayvalue,"ýi","IÝ") && Local language fix
  this.value = this.displayvalue
  this.displayvalue = this.value
ENDPROC


  PROCEDURE Init
  WITH This
    .rowsourcetype = 3
    IF lower(.fieldname)="none" or ;
        lower(.aliasname)="none"   && Lookup is same as controlsource alias
      .fieldname = substr(.controlsource,rat(".",.controlsource)+1)
      .aliasname = substr(.controlsource,1,;
        rat(".",.controlsource)-1)
    ENDIF
    .rowsource = [SELECT DISTINCT ]+THIS.fieldname +;
      [ as dummy FROM ]+this.aliasname+[ where !empty(]+THIS.fieldname + ;
      [) union ] +;
      [SELECT this.displayvalue as dummy ] +;
      [ FROM ]+this.aliasname + ;
      [ union ] +;
      [SELECT this.value as dummy ] +;
      [ FROM ]+this.aliasname + ;
      [ INTO cursor qq order by 1 ]
    IF .parent.baseclass = "Column"
      .parent.sparse = .t.  && Force sparse .t. for grids
    ENDIF
  ENDWITH
ENDPROC


ENDDEFINE
*
*-- EndDefine: cmbself_edit
**************************************************
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform