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!
Dual confirm message when closing a tab, then exception
-
- Site Admin
- Posts: 17524
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Site Admin
- Posts: 17524
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
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:
2) At the end of TSRVTabSet.WMMouseUp, add:
This change will be included in the next update.
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;
Code: Select all
IsMouseUp := False;
Problem solved
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!
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!