Not able to reliably track bitmap changes in control

  • I'm using the textdynamic control in an app where I need to track changes in a very efficient way, as i will be passing data across a very slow data connection (and expensive data rates) and i need to keep my memory footprint as low as inhumanly possible!

    Because of this i cannot cache the original state of the controls content and i need to minimize drastically any queries about the original state of the control, so i cannot be checking every now and again to see if the current contents equals the original contents. I need a better way of tracking changes.

    However i've noticed problems.
    There appears to be no reliable way to track if the contents have changed or not, and it appears to be because of what looks like a bad combination of bugs or at least undesirable behaviour within the control. Basically the events and state of the control are unreliable for tracking changes.

    1) the textchanged event doesnt seem to always fire when the text has changed. It doesn't get fired when a bitmap is attached to the control by using the "attach image" toolbar button. It does however if you paste from the clipboard. This seems like a bug, or at least inconsistent. It also means you cannot rely on the event to track changes.

    2) When a bitmap image is attached to the control by clicking on the built in image attach toolbar button, the undo stack clears. (If however a bitmap is pasted from the clipboard, the undo stack works properly). it seems inconsistent. Querying the undo status, or listening for undo events does not help if someone attaches an image via the toolbar button. Attaching a bitmap using the button, and the undo stack clearning seems like a bug to me.

    3) Using the OnUpdateGUI method of querying for changes is unreliable too. Particularly with the add image button. if you query the changed state it says that an undo isnt available, but it clearly should be. probably because of the bug mentioned at (2)

    4) Listening in to the event saying a button has been pressed doesn't help, i can even find out which button it was, but i dont know if they then pressed cancel or not on the resulting dialog.

    How does someone reliably track changes? In particular how does someone reliably listen to see if the toolbar button for attaching images has been used to attach an image.

    Or, are there any plans to fix up the events/undo stack so that they can be used in a reliable manner?

    • Offizieller Beitrag

    Hi,

    instead for waiting for the textchanged You can also Set and check the property Modified. Memo.SetBProp(0, 12, 0)

    I am not sure why the insert image does not trigger the change event or undo, but I check that. Of course undo should work, too.

    Are you sure no reload of the text happens when the TextChange event happens. In Delphi this would be the case and is often a problem with large blobs. That would clear the undo stack.

    Julian