>Space = =CHR(168) && This is the space replacement character >>
>Procedure KeyPress >LPARAMETERS nKeyCode, nShiftAltCtrl >LOCAL lcBegText, lcEndText >DO CASE > CASE nKeyCode = 7 && Delete key > DO CASE > CASE this.SelLength >= LEN(this.Tag) .AND. this.SelStart = 0 > lcBegText = "" > lcEndText = "" > CASE this.SelLength > 0 .AND. this.SelLength < LEN(this.Tag) > lcBegText = LEFT(this.Tag,this.SelStart) > lcEndText = SUBSTR(this.Tag,this.SelStart+this.SelLength+1) > OTHERWISE > lcBegText = LEFT(this.Tag,this.SelStart) > lcEndText = SUBSTR(this.Tag,this.SelStart+2) > ENDCASE > this.Tag = lcBegText + lcEndText > > CASE nKeyCode = 127 && Backspace key > IF this.SelLength = 0 > lcBegText = IIF(this.SelStart>1,LEFT(this.Tag,this.SelStart-1),"") > lcEndText = SUBSTR(this.Tag,this.SelStart+1) > ELSE > lcBegText = IIF(this.SelStart>1,LEFT(this.Tag,this.SelStart),"") > lcEndText = SUBSTR(this.Tag,this.SelStart+this.SelLength+1) > ENDIF > this.Tag = lcBegText + lcEndText > > CASE BETWEEN(nKeyCode,32,126) && Printable key > DO CASE >*-* Inserting character end of text > CASE this.SelStart = LEN(this.Tag) .AND. this.SelLength = 0 > lcBegText = this.Tag > lcEndText = "" > >*-* Inserting character in mid text > CASE this.SelStart < LEN(this.Tag) .AND. this.SelLength = 0 > lcBegText = LEFT(this.Tag,this.SelStart) > lcEndText = SUBSTR(this.Tag,this.SelStart+1) > >*-* Replacing character(s) > CASE this.SelStart < LEN(this.Tag) .AND. this.SelLength > 0 > lcBegText = LEFT(this.Tag,this.SelStart) > lcEndText = SUBSTR(this.Tag,this.SelStart+this.SelLength+1) > OTHERWISE > WAIT WINDOW "ERROR: Unhandled Keyboard Entry" > lcBegText = this.Tag > lcEndText = "" > ENDCASE > this.Tag = lcBegText + CHR(nKeyCode) + lcEndText >ENDCASE >this.Tag = STRTRAN(this.Tag,CHR(32),this.Space) >EndProc > > >Procedure GotFocus >this.DisplayValue = this.Tag >EndProc >>
If nKeyCOde=32 NoDefault DoDefault(168, nShiftAltCtrl) EndIfBTW, are you aware that chr(255) looks just like chr(32) with many fonts?