indikad wrote:I am looking for a sales "order line changing" event and cannot find one...
seems that it may not be there according to this post below ?
viewtopic.php?f=26&t=383&p=1267&hilit=Line+changed#p1267I need to stop a user from editing lines such as quantity and price without having to write code to remember previous values etc .. etc..
There are some options open to you relating to this.
If you create a plugin which adds a handler for the grid change event in the "SetupBeforeHandlers" of the FormPlugin, you can then decide in code to cancel the edit by throwing a ClientCancelledException - this will cause a silent fail (no message to the user). If you want to display a message, you can just throw a new exception (of any type, just not our ClientCancelledException).
That will stop the change being pushed to the business logic and it will be as though the edit never occurred as far as the business logic is concerned. However, the user will be left looking at the values in the grid thinking their changes have been accepted. You can push back into the grid the values from the business logic at this point so they see their edit "undone", but keep in mind this may fire another change event - so you may need to introduce some logic to know who's changing the grid - the user, or your code - otherwise you'll blow the stack.
There are also other events the grid provides which may assist - when a user edits a cell there is an event which affects the EditMode of the cell - you could hook into that to work out if the edit mode has changed, and then perform your validation and set the cell contents back to what it was (from memory with some editmode change events you get the before and after values).
You can also set the MinValue and MaxValue for the cell, if that's suitable (i.e.: a numeric or date type) - you'd do that in the LineDisplayed event of the form - this will prevent the user from entering a value outside the range specified, and would make everything a lot simpler.
If you get stuck on this, post back here and I'll whip up a sample to do what you want.