Author | Topic: Problems with XbpMLE Insert() and PasteMarked() | |
---|---|---|
Andreas Gehrs-Pahl | Problems with XbpMLE Insert() and PasteMarked() on Tue, 29 Jun 2010 20:30:45 -0400 Dear Alaska Support Team, The methods :Insert() and :PasteMarked() of the XbpMLE() class limit the amount of characters that can be inserted or pasted. The actual number of characters that will be inserted or pasted apparently depends on the current size of the :EditBuffer(). If the :EditBuffer is empty, exactly 30.000 characters can be inserted. After that, only an additional 4,096 characters can be pasted at once into the object. If XbpMLE():SetData() is used so that the :EditBuffer() already contains some text -- for example 50,000 characters -- the number of characters that can be pasted at once is limited by that :EditBuffer() size. It's size can increase to only twice it's original size, which means in the case of 50,000 characters, it can grow to 100,000 characters. This means that only 50,000 additional characters can be pasted or inserted, unless some of the existing characters in the :EditBuffer() are replaced. If all characters are replaced, a maximum of 100,000 characters can be inserted or pasted. Each consecutive insert or paste operation can increase the size of the :EditBuffer() in the same way. The :EditBuffer() and :SetData() methods have no such size limitations. This problem can be fixed in a derived class by overloading the :Insert() and :PasteMarked() methods, to internally use the :EditBuffer() method instead. For some reason, specifying OVERRIDE for those methods doesn't seem to have an effect on the base class, though, as the default behavior of the XbpMLE() class can't be fully fixed this way. To completely fix it, the :Keyboard() method must also be overloaded to redirect the CTRL-V and Shift-Insert key events and a new pop-up menu must be added to replace the existing one, which contains a "Paste" option. -- Andreas --- --- Andreas Gehrs-Pahl E-Mail: GPahl@CharterMI.net 415 Gute Street or: Andreas@DDPSoftware.com Owosso, MI 48867-4410 or: Andreas_Gehrs-Pahl@CrimeCog.com Tel: (989) 723-9927 Web Site: http://www.Aerospace-History.net --- --- | |
Andreas Gehrs-Pahl | Re: Problems with XbpMLE Insert() and PasteMarked() on Wed, 30 Jun 2010 18:20:20 -0400 Dear Alaska Support Team, I noticed that you created PDR 109-6305 for this issue. But I would have liked it better, if this PDR included all the issues raised. I also have to disagree with the "Solution" that was provided. The only solution for the :PasteMarked() problem is to subclass the MLE, including the :Keyboard() method and replacing the Popup Menu. And using the :SetData() method instead of :Insert() is not a good idea, as this has (usually undesirable) side effects, like executing the :DataLink code block. Instead, the :EditBuffer() method should be used. Not to mention that using either :SetData() or :EditBuffer() will require the replacing of any marked text at the desired cursor position, and keeping the existing, non-marked text, before and after the cursor position. So it isn't that straight forward and simple as your "Use the :SetData() method instead of :Insert()" solution makes it look like. Could you also elaborate on why the OVERRIDE clause has no effect on the XbpMLE class? Even with the :Insert() and :PasteMarked() methods replaced and marked as OVERRIDE, it still isn't possible to successfully Paste a large text into a sub-classed MLE. I thought that the OVERRIDE clause was designed to accomplish exactly that! Apparently the XbpMLE is using a different method to accomplish the pasting of text from the clipboard. To me, this seems to be inconsistent with Xbase++ OOP principles. Because the code of the XbpMLE():Keyboard() method and the code for the built-in Popup Menu's "Paste" option are not available to us, we should be able to rely on the fact that they internally call the :PasteMarked() method, which in return should call the :Insert() method. If that isn't the case, sub-classing and using OVERRIDE isn't very useful in the real world. -- Andreas --- --- Andreas Gehrs-Pahl E-Mail: GPahl@CharterMI.net 415 Gute Street or: Andreas@DDPSoftware.com Owosso, MI 48867-4410 or: Andreas_Gehrs-Pahl@CrimeCog.com Tel: (989) 723-9927 Web Site: http://www.Aerospace-History.net --- --- | |
Till Warweg | Re: Problems with XbpMLE Insert() and PasteMarked() on Thu, 01 Jul 2010 10:04:39 +0200 Hello Andreas, > I noticed that you created PDR 109-6305 for this issue. But I would have > liked it better, if this PDR included all the issues raised. I also have > to disagree with the "Solution" that was provided. I'm aware the PDR doesn't reflect every issue you've raised in your posting. I'm still working on it, which is also why I hadn't responded. Please give me some time to work on this... Best regards, Till Warweg [Alaska Software] -------------------------------------------------------------------- Technical Support: support@alaska-software.com News Server: news.alaska-software.com Homepage: http://www.alaska-software.com KnowledgeBase: http://www.alaska-software.com/kb -------------------------------------------------------------------- "Andreas Gehrs-Pahl" schrieb im Newsbeitrag news:pxv85c4lpqgy$.61gwpethksg4.dlg@40tude.net... > Dear Alaska Support Team, > > I noticed that you created PDR 109-6305 for this issue. But I would have > liked it better, if this PDR included all the issues raised. I also have > to disagree with the "Solution" that was provided. > > The only solution for the :PasteMarked() problem is to subclass the MLE, > including the :Keyboard() method and replacing the Popup Menu. And using > the :SetData() method instead of :Insert() is not a good idea, as this > has (usually undesirable) side effects, like executing the :DataLink > code block. Instead, the :EditBuffer() method should be used. Not to > mention that using either :SetData() or :EditBuffer() will require the > replacing of any marked text at the desired cursor position, and keeping > the existing, non-marked text, before and after the cursor position. So > it isn't that straight forward and simple as your "Use the :SetData() > method instead of :Insert()" solution makes it look like. > > Could you also elaborate on why the OVERRIDE clause has no effect on the > XbpMLE class? Even with the :Insert() and :PasteMarked() methods replaced > and marked as OVERRIDE, it still isn't possible to successfully Paste a > large text into a sub-classed MLE. I thought that the OVERRIDE clause was > designed to accomplish exactly that! Apparently the XbpMLE is using a > different method to accomplish the pasting of text from the clipboard. > To me, this seems to be inconsistent with Xbase++ OOP principles. > > Because the code of the XbpMLE():Keyboard() method and the code for the > built-in Popup Menu's "Paste" option are not available to us, we should > be able to rely on the fact that they internally call the :PasteMarked() > method, which in return should call the :Insert() method. If that isn't > the case, sub-classing and using OVERRIDE isn't very useful in the real > world. > > -- Andreas > > --- --- > Andreas Gehrs-Pahl E-Mail: GPahl@CharterMI.net > 415 Gute Street or: Andreas@DDPSoftware.com > Owosso, MI 48867-4410 or: Andreas_Gehrs-Pahl@CrimeCog.com > Tel: (989) 723-9927 Web Site: http://www.Aerospace-History.net > --- --- | |
Till Warweg | Re: Problems with XbpMLE Insert() and PasteMarked() on Fri, 02 Jul 2010 11:42:05 +0200 Hi Andreas et all, FYI: I've just updated PDR 6305 which describes the problem with :Insert() and :PasteMarked() Andreas has reported. It turns out the problem is due to an internal buffer limit of the edit control used by the XbpMLE class. This buffer has to be increased to allow larger inserts or pastes. This doesn't work right in the methods being discussed. The easiest way to get around this probably is to use :SetData() to temporarily increase the edit buffer. This can be done directly after the call to :Create(). Once the buffer was increased past the offending limit, subsequent calls to :Insert() and :PasteMarked() should work as expected. The following code snippet was copied from the "Solution" section in the PDR, and illustrates this approach. Andreas, could you please check this out in your original scenario? The work-around Andreas suggested is valid too, of course! #define WORK_AROUND_PDR6305 Max. number of chararacters which can be inserted at once #define MLE_MAXBUFFER_PDR6305 100000 (...) oMLE := XbpMLE():New(...):Create(...) #ifdef WORK_AROUND_PDR6305 WORKAROUND_PDR6305( oMLE ) (See below) #endif (...) -- #ifdef WORK_AROUND_PDR6305 PROCEDURE WORKAROUND_PDR6305( oMLE ) Temporarily extend edit buffer to have internal limits increased for later pastes and inserts oMLE:SetData( replicate(" ", MLE_MAXBUFFER_PDR6305) ) oMLE:SetData("") RETURN #endif Best regards, Till Warweg [Alaska Software] PS. Andreas: there is the OVERRIDE issue still between us, I know. I just wanted to reported findings on the MLDE before delving into this one... -------------------------------------------------------------------- Technical Support: support@alaska-software.com News Server: news.alaska-software.com Homepage: http://www.alaska-software.com KnowledgeBase: http://www.alaska-software.com/kb -------------------------------------------------------------------- "Till Warweg" schrieb im Newsbeitrag news:6a161904$258b05cd$292ff@news.alaska-software.com... > Hello Andreas, > >> I noticed that you created PDR 109-6305 for this issue. But I would have >> liked it better, if this PDR included all the issues raised. I also have >> to disagree with the "Solution" that was provided. > > I'm aware the PDR doesn't reflect every issue you've raised in your > posting. I'm still working on it, which is also why I hadn't responded. > > Please give me some time to work on this... > > -- > Best regards, > Till Warweg > [Alaska Software] > > -------------------------------------------------------------------- > Technical Support: support@alaska-software.com > News Server: news.alaska-software.com > Homepage: http://www.alaska-software.com > KnowledgeBase: http://www.alaska-software.com/kb > -------------------------------------------------------------------- > > > > "Andreas Gehrs-Pahl" schrieb im Newsbeitrag > news:pxv85c4lpqgy$.61gwpethksg4.dlg@40tude.net... >> Dear Alaska Support Team, >> >> I noticed that you created PDR 109-6305 for this issue. But I would have >> liked it better, if this PDR included all the issues raised. I also have >> to disagree with the "Solution" that was provided. >> >> The only solution for the :PasteMarked() problem is to subclass the MLE, >> including the :Keyboard() method and replacing the Popup Menu. And using >> the :SetData() method instead of :Insert() is not a good idea, as this >> has (usually undesirable) side effects, like executing the :DataLink >> code block. Instead, the :EditBuffer() method should be used. Not to >> mention that using either :SetData() or :EditBuffer() will require the >> replacing of any marked text at the desired cursor position, and keeping >> the existing, non-marked text, before and after the cursor position. So >> it isn't that straight forward and simple as your "Use the :SetData() >> method instead of :Insert()" solution makes it look like. >> >> Could you also elaborate on why the OVERRIDE clause has no effect on the >> XbpMLE class? Even with the :Insert() and :PasteMarked() methods replaced >> and marked as OVERRIDE, it still isn't possible to successfully Paste a >> large text into a sub-classed MLE. I thought that the OVERRIDE clause was >> designed to accomplish exactly that! Apparently the XbpMLE is using a >> different method to accomplish the pasting of text from the clipboard. >> To me, this seems to be inconsistent with Xbase++ OOP principles. >> >> Because the code of the XbpMLE():Keyboard() method and the code for the >> built-in Popup Menu's "Paste" option are not available to us, we should >> be able to rely on the fact that they internally call the :PasteMarked() >> method, which in return should call the :Insert() method. If that isn't >> the case, sub-classing and using OVERRIDE isn't very useful in the real >> world. >> >> -- Andreas >> >> --- --- >> Andreas Gehrs-Pahl E-Mail: GPahl@CharterMI.net >> 415 Gute Street or: Andreas@DDPSoftware.com >> Owosso, MI 48867-4410 or: Andreas_Gehrs-Pahl@CrimeCog.com >> Tel: (989) 723-9927 Web Site: http://www.Aerospace-History.net >> --- --- > | |
Till Warweg | TOPIC SWITCH: OVERRIDE [was: Problems with XbpMLE Insert() and PasteMarked()] on Fri, 02 Jul 2010 13:00:53 +0200 Hi again, Andreas. Just to make sure I understand you correctly; as a work-around for the problem with :Insert() and :PasteMarked(), you sub-classed XbpMLE and created your own (corrected) versions of :Insert() and :PasteMarked(). The issue now is that even if the methods are declared as OVERRIDE, your implementation isn't called in all cases. More specifically, what you expect is that choosing "Paste" from the MLE context menu should call :Insert() or :PasteMarked(), is that it? If this is what the discussion is about (and not a problem with OVERRIDE which I haven't yet grasped), the culprit probably is in the fact that the context menu is opened by the edit control itself. It's not ours. In other words, the control is kind of talking to itself when doing pastes. In this case, OVERRIDE has no effect because XbpMLE is unaware of the proceedings. Does this answer your question? Best regards, Till Warweg [Alaska Software] -------------------------------------------------------------------- Technical Support: support@alaska-software.com News Server: news.alaska-software.com Homepage: http://www.alaska-software.com KnowledgeBase: http://www.alaska-software.com/kb -------------------------------------------------------------------- "Andreas Gehrs-Pahl" schrieb im Newsbeitrag news:pxv85c4lpqgy$.61gwpethksg4.dlg@40tude.net... > Dear Alaska Support Team, > > I noticed that you created PDR 109-6305 for this issue. But I would have > liked it better, if this PDR included all the issues raised. I also have > to disagree with the "Solution" that was provided. > > The only solution for the :PasteMarked() problem is to subclass the MLE, > including the :Keyboard() method and replacing the Popup Menu. And using > the :SetData() method instead of :Insert() is not a good idea, as this > has (usually undesirable) side effects, like executing the :DataLink > code block. Instead, the :EditBuffer() method should be used. Not to > mention that using either :SetData() or :EditBuffer() will require the > replacing of any marked text at the desired cursor position, and keeping > the existing, non-marked text, before and after the cursor position. So > it isn't that straight forward and simple as your "Use the :SetData() > method instead of :Insert()" solution makes it look like. > > Could you also elaborate on why the OVERRIDE clause has no effect on the > XbpMLE class? Even with the :Insert() and :PasteMarked() methods replaced > and marked as OVERRIDE, it still isn't possible to successfully Paste a > large text into a sub-classed MLE. I thought that the OVERRIDE clause was > designed to accomplish exactly that! Apparently the XbpMLE is using a > different method to accomplish the pasting of text from the clipboard. > To me, this seems to be inconsistent with Xbase++ OOP principles. > > Because the code of the XbpMLE():Keyboard() method and the code for the > built-in Popup Menu's "Paste" option are not available to us, we should > be able to rely on the fact that they internally call the :PasteMarked() > method, which in return should call the :Insert() method. If that isn't > the case, sub-classing and using OVERRIDE isn't very useful in the real > world. > > -- Andreas > > --- --- > Andreas Gehrs-Pahl E-Mail: GPahl@CharterMI.net > 415 Gute Street or: Andreas@DDPSoftware.com > Owosso, MI 48867-4410 or: Andreas_Gehrs-Pahl@CrimeCog.com > Tel: (989) 723-9927 Web Site: http://www.Aerospace-History.net > --- --- |