Author | Topic: oGet:undo() does not work | |
---|---|---|
Carlos a Beling | oGet:undo() does not work on Fri, 17 Dec 2010 19:27:14 -0200 | |
Andreas Gehrs-Pahl | Re: oGet:undo() does not work on Mon, 20 Dec 2010 16:27:18 -0500 Carlos, >I need undo the entry of the fiel using the @ ... Say.. Get traditional >command. Pressing Ctrl+U -- while the Get object has focus -- will execute the "oGet:Undo()" method, and reset the contents of the "oGet:Buffer" to the contents of the "oGet:Original" buffer. This works fine in your code. >The problem is that I did not enconter a way for to do it. >Iaddedanexampletoask if someonecan,please, tell me what iswrong. You try to execute the "oGet:Undo()" method in the code called by your "oGet:PostBlock" code block -- which is assigned with the Valid (or Range) clause of the "@ Get" command -- and this will be called from inside the "ReadModal()" function -- which is your "Read" command. Because the code in the "GetPostValidate()" function changes the "oGet:Original" buffer to the contents of the "oGet:Buffer", the UNDO functionality isn't available anymore in your "_Back()" and "_RangeOK()" functions. To change this behavior, you could modify/overload the "GetPostValidate()" function in the "Alaska\XppW32\Source\Sys\GetSys.prg" program, where in line 305 "oGet:Reset()" is called, which will re-set the oGet:Original iVar to the same value as the oGet:Buffer, making any "oGet:Undo()" after that time impossible. Place in front of the "oGet:Reset()" the following line: "oGet:Cargo := oGet:Original" Then in your "_Back()" and "_RangeOK()" functions, replace the calls to "oGet:Undo()" with the following: "oGet:VarPut(oGet:Cargo) ; oGet:UpdateBuffer()" This will work the way you want it to work, I suppose. As I don't use the console @ Get/Read mode, I don't know if this is by design or the same as Clipper or could qualify as an error and require a PDR. But it seems that line 346 in the "GetDoSetKey()" function in the "GetSys.prg" program would indicate that this isn't intend behavior, and should qualify for a PDR, even though this has been working like this since at least 12 years, and Xbase++ Version 1.20.178 behaves the same way. You might want to contact Alaska Support directly with this, if it's important to you. See also PDRs 109-2615 and 109-4509, even though they aren't quite accurate in their descriptions and solutions. Andreas Andreas Gehrs-Pahl Absolute Software, LLC phone: (989) 723-9927 email: Andreas.GP@Charter.net Andreas_Gehrs-Pahl@EJusticeSolutions.com Andreas@DDPSoftware.com web: http://www.Aerospace-History.net | |
Carlos a Beling | Re: oGet:undo() does not work on Tue, 21 Dec 2010 10:13:53 -0200 Hello Andreas: good morning. Many thanks. I did what you suggested and I built in a function (GetUndo_()) that's working fine. If one wish the solution I can post it here. Beling Greetings Em 20/12/2010 19:27, Andreas Gehrs-Pahl escreveu: > Carlos, > >> I need undo the entry of the fiel using the @ ... Say.. Get traditional >> command. > Pressing Ctrl+U -- while the Get object has focus -- will execute the > "oGet:Undo()" method, and reset the contents of the "oGet:Buffer" to the > contents of the "oGet:Original" buffer. This works fine in your code. > >> The problem is that I did not enconter a way for to do it. >> Iaddedanexampletoask if someonecan,please, tell me what iswrong. > You try to execute the "oGet:Undo()" method in the code called by your > "oGet:PostBlock" code block -- which is assigned with the Valid (or Range) > clause of the "@ Get" command -- and this will be called from inside the > "ReadModal()" function -- which is your "Read" command. Because the code > in the "GetPostValidate()" function changes the "oGet:Original" buffer to > the contents of the "oGet:Buffer", the UNDO functionality isn't available > anymore in your "_Back()" and "_RangeOK()" functions. > > To change this behavior, you could modify/overload the "GetPostValidate()" > function in the "Alaska\XppW32\Source\Sys\GetSys.prg" program, where in > line 305 "oGet:Reset()" is called, which will re-set the oGet:Original iVar > to the same value as the oGet:Buffer, making any "oGet:Undo()" after that > time impossible. Place in front of the "oGet:Reset()" the following line: > > "oGet:Cargo := oGet:Original" > > Then in your "_Back()" and "_RangeOK()" functions, replace the calls to > "oGet:Undo()" with the following: > > "oGet:VarPut(oGet:Cargo) ; oGet:UpdateBuffer()" > > This will work the way you want it to work, I suppose. As I don't use the > console @ Get/Read mode, I don't know if this is by design or the same as > Clipper or could qualify as an error and require a PDR. But it seems that > line 346 in the "GetDoSetKey()" function in the "GetSys.prg" program would > indicate that this isn't intend behavior, and should qualify for a PDR, > even though this has been working like this since at least 12 years, and > Xbase++ Version 1.20.178 behaves the same way. You might want to contact > Alaska Support directly with this, if it's important to you. See also PDRs > 109-2615 and 109-4509, even though they aren't quite accurate in their > descriptions and solutions. > > Andreas |