Dual confirm message when closing a tab, then exception

ScaleRichView support and discussion (TRichView add-on for WYSIWYG editing)
Post Reply
nachbar
Posts: 11
Joined: Sun Dec 12, 2010 11:35 pm
Contact:

Dual confirm message when closing a tab, then exception

Post by nachbar »

I am using the ActionTestTabsCB2010 example code in CB2010. When I compile the demo, with no changes, I get the following behavior:

1) Compile and run the demo
2) The program starts, opening readme.rvf in the new window
3) Select File/Open, and open a new .rtf file in a new tab
4) Make a change to the new file (i.e., press the space key)
5) Click the "x" on the tab for the newly opened and modified file, to close that tab.
6) I get TWO confirmation message boxes, one right after the other, both saying "Save changes to <file name>.rtf?" If you click NO to the first one, the tab goes away, but you have to answer the second dialog. If you click NO to that one, you get a DynArrayOutOfRange exception.

Can anyone replicate that? Any idea why the demo code is not working?

Thanks!
Sergey Tkachenko
Site Admin
Posts: 17524
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

I confirm the bug. It is obviously a C++Bulder demo's bug, because Delphi demo is ok.
I'll post a fix tomorrow.
Sergey Tkachenko
Site Admin
Posts: 17524
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

After more testing, I found that this error occurs in Unicode versions of Delphi and C++Builder (starting from v2009).
It's very strange: when you call Unicode version of MessageBox from SRVTabSet.OnCloseTab (which is called from SRVTabSet.WMMouseUp), this MessageBox sends mouse messages to the tabset, invoking SRVTabSet.WMMouseUp and SRVTabSet.OnCloseTab one more time, so MessageBox is called twice recursively!
Sorry, I do not know why it happens, but a workaround can be added in SRVTabSet.pas.
1) Add IsMouseUp : Boolean to the private section of TSRVTabSet class.
2) At the beginning of TSRVTabSet.WMMouseUp, add:

Code: Select all

    if IsMouseUp then
       exit;
    IsMouseUp := True;
2) At the end of TSRVTabSet.WMMouseUp, add:

Code: Select all

    IsMouseUp := False;
This change will be included in the next update.
nachbar
Posts: 11
Joined: Sun Dec 12, 2010 11:35 pm
Contact:

Problem solved

Post by nachbar »

Thanks -- that fixed it.

I would parenthetically comment that this demo is the reason I bought TRichView/ScaleRichView. I compiled, ran, and examined it before deciding to buy. It gave me the confidence that TRichView would do what I needed, and a working demo of a generic word processor was the perfect starting point for my project.

Thanks!
Post Reply