PUBLIC ofrmeditcfp > >strtofile( "some text", "testfile.txt" ) > >ofrmeditcfp=createOBJECT("frmeditcfp", "testfile.txt") >ofrmeditcfp.Show > >modi file "testfile.txt" >RETURN > >DEFINE CLASS frmeditcfp AS form > > > Height = 204 > Width = 454 > ShowWindow = 1 > DoCreate = .T. > AutoCenter = .T. > Caption = "Edit MPS-configuratiebestand" > MinButton = .F. > KeyPreview = .T. > WindowType = 1 > *-- Name of configFP. > cCFP = ('') > *-- Drive+Dir+Filename of configFP. > cDDF = ('') > *-- Old text of ConfigFP. > cOldCFP = ('') > Name = "frmEditCFP" > > ADD OBJECT edtcfp AS editbox WITH ; > FontName = "Courier New", ; > Height = 204, ; > Left = 0, ; > Top = 0, ; > Width = 456, ; > ControlSource = "thisform.cCFP", ; > Name = "edtCFP" > > PROCEDURE Resize > with thisform > .edtCFP.width = .width > .edtCFP.height = .height > endwith > ENDPROC > > PROCEDURE Init > lparameter tcDDF > > local array laF[1,5] > > with thisform > .cDDF = m.tcDDF > .cCFP = filetostr( .cDDF ) > .cOldCFP = .cCFP > .caption = 'Edit ' + .cDDF > * > if adir( laF, .cDDF ) = 0 ; > or 'R' $ laF[ 1, 5 ] ; > or 'D' $ laF[ 1, 5 ] > * > .caption = .caption + ' (ReadOnly)' > .edtCFP.readonly = .T. > endif > endwith > ENDPROC > > PROCEDURE KeyPress > LPARAMETERS nKeyCode, nShiftAltCtrl > > with thisform > do case > case nKeyCode = 27 > if not ( .cCFP == .cOldCFP ) > if messagebox( "Discard changes?", 4+32, "Abort" ) = 7 && if no > nodefault > return > endif > endif > nodefault > thisform.cDDF = '' > thisform.release() > case inlist( nKeyCode, 23, 19 ) && ctrl+w, ctrl+s > nodefault > thisform.release() > endcase > endwith > ENDPROC > > PROCEDURE Unload > with thisform > if not empty( .cDDF ) and not ( .cCFP == .cOldCFP ) > strtofile( .cCFP, .cDDF, 0 ) > endif > endwith > ENDPROC >ENDDEFINE>
? inkey(0),"<",inkey(0),"<",inkey(0),"<",inkey(0),"<">>>