Please help me on how to get every changes from a texteditor?
Here is my example script where only the first keypress in the texteditor triggers "haschanged" event.
TextEditor.HasChanged really seems to behave differently on MUI and Windows. On Windows it triggers for every character that changes, on MUI only for the first change. Now the question is which is the better behaviour: Should it trigger just once or for every character that changes? Triggering for every character can be a huge waste of CPU cycles of course so I'm not sure whether this is the best behaviour.
Both lazi and PEB seem to need such a behaviour, though, so maybe you can describe why exactly you want to be notified for every character that changes? I currently can't think of a situation in which such a behaviour is necessary so please elaborate...
My current need of haschanged is very simple. I want to know if the content is changed after opening or after last save operation.
I got a notify on the first change and after saving the content this changed state should be cleared somehow to look for the next change.
So there is no need to get every change if I can reset the changed state manually.
According to the notify on every keypress, I can imagine an editor like the good old Amos editor which was formatted the line or comand after every space or enter keypress.
lazi wrote:My current need of haschanged is very simple. I want to know if the content is changed after opening or after last save operation.
I got a notify on the first change and after saving the content this changed state should be cleared somehow to look for the next change.
So there is no need to get every change if I can reset the changed state manually.
Hmm, now I'm confused. So why did you ask how to get a notification for every key press?
According to the notify on every keypress, I can imagine an editor like the good old Amos editor which was formatted the line or comand after every space or enter keypress.
That's true but implementing syntax highlighting is far too advanced for RapaGUI's text editor class. This will lead to trouble. We'd need a platform-independent, more flexible engine like Scintilla for that.
Hmm, now I'm confused. So why did you ask how to get a notification for every key press?
Did I ask it?
When I was not able to solve the problem just got the idea that squeezing every changes from the gadget will give a solution. And if one thinks too much in the bad direction can't leave it easily
And what do you say? Have you found a good idea for this particular problem?
It is surely a tough task to foresee how evil things the users will do and call it programming
Ok forget about the requirements of syntax highlighting. Scintilla is really far better for code editing than current texteditor.mcp.
I think I know now why the different behaviour could be a problem: When using the TextEditor.hws example on Amiga, you'll only get one "HasChanged" notification. This leads to the problem that if you modify the text after having saved it, there'll be no more "HasChanged" notifications which is indeed a problem. On Windows, Linux, and Mac OS this isn't a problem because the "HasChanged" events will be generated for every change. That's why I have fixed RapaGUI now to use the same behaviour on AmigaOS too.
- Fix [Amiga]: TextEditor.HasChanged triggers for every change now, not only for the first one; this
makes the Amiga version consistent to the behaviour of the Windows, Linux, and Mac OS versions of
RapaGUI; requires TextEditor.mcc 15.48 or better
Hmmm. But what about MUIRoyale?
As I said it should not notify on every keypress.
But what is it good for if only the first keypress is notified?
The best way IMHO would be the ability to reset the modified state.
lazi wrote:Hmmm. But what about MUIRoyale?
As I said it should not notify on every keypress.
But what is it good for if only the first keypress is notified?
The best way IMHO would be the ability to reset the modified state.
That's already possible. Just reset it manually and you'll get a new notification on the next keypress, i.e. do something like this: