>procedure thisform.Edit1.Keypress >Lparameters nKeyCode, nShiftAltCtrl >If nKeyCode = 13 > lcCrLf = Chr(13) + Chr(10) > lccomand = Thisform.select_command(This.SelStart, This.Value) > * > lnStart = Thisform.Edit1.SelStart > lnlinetotxt = Occurs(lcCrLf, Left(Thisform.Edit1.Text, lnStart)) > lnStart = Len(Thisform.Edit1.Text) > lnlinetot = Occurs(lcCrLf, Left(Thisform.Edit1.Text, lnStart)) > lcCommrest = "" > lcCommfw = "" > llgoprocess = .f. > * > If lnlinetotxt = lnlinetot > If ";" $ lccomand > ELSE > llgoprocess = .t. > lcCommrest = thisform.check_fullcommand(Thisform.Edit1.Text, "backward", lnlinetotxt) > ENDIF > ELSE > llgoprocess = .t. > > * > * get lines forward (if ; character inside current command > * > If ";" $ lccomand > lcCommfw = thisform.check_fullcommand(Thisform.Edit1.Text, "forward", lnlinetotxt) > Endif > * > * get lines backward > * > lcCommrest = thisform.check_fullcommand(Thisform.Edit1.Text, "backward", lnlinetotxt) > ENDIF > IF llgoprocess > lcgocommand = ALLTRIM(Chrtran(lcCommrest+" "+lccomand+" "+lcCommfw, ";", " ")) > thisform.go_command(lcgocommand) > endif > If lnlinetotxt=lnlinetot > Else > *vfp's behavior > lcsend = Chrtran(lcCommrest+lccomand+lcCommfw, ";", " ") > This.Value = This.Text + lcsend + lcCrLf > This.SelStart = Len(This.Text)+LEN(lcsend)+1 > NODEFAULT > this.Refresh() > Return .F. > Endif >Endif >endproc > > >procedure thisform.select_command >Lparameters pnSelStart, pcvalue >lnStart = Thisform.Edit1.SelStart >lcCrLf = CHR(13) + CHR(10) >lnOccurence = OCCURS(lcCrLf, LEFT(Thisform.Edit1.Text, lnStart)) >lcCommand = STREXTRACT(lcCrLf + Thisform.Edit1.Text, lcCrLf ,lcCrLf, lnOccurence + 1,2) >RETURN lcCommand >endproc > > >procedure thisform.check_fullcommand >Lparameters pcText, pckind, pnlinetotxt >Alines(laLines, pcText) >lcCommret = "" >If pckind="backward" > * > * get lines backward > * > Do While pnlinetotxt>1 > If Empty(laLines[pnlinetotxt]) .Or. Substr(Alltrim(laLines[pnlinetotxt]),1,1)="*" > Else > If ";"$laLines[pnlinetotxt] > lcCommret = laLines[pnlinetotxt] + lcCommret > Else > pnlinetotxt = 1 > Loop > Endif > Endif > pnlinetotxt = pnlinetotxt - 1 > Enddo >Endif >If pckind="forward" > * > * get lines forward (if ; character inside current command > * > lnlins = lnlinetotxt+2 > Do While !lnlins > lnlinetot > If Empty(laLines[lnlins]) .Or. Substr(Alltrim(laLines[lnlins]),1,1)="*" > Else > lcCommret= lcCommret + laLines[lnlins] > If ";"$laLines[lnlins] > Else > lnlins = lnlinetot+1 > Loop > Endif > Endif > lnlins = lnlins + 1 > Enddo >Endif >Return lcCommret >endproc >I'm not sure what this code is doing, but quick observation - if you code it from the editbox events, use THIS instead of the full object reference.