View Issue Details

IDProjectCategoryView StatusLast Update
0005413JEDI VCL00 JVCL Componentspublic2011-06-21 14:50
ReporterCDamettoAssigned Tojfudickar 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.40 
Target VersionFixed in Version 
Summary0005413: problem with the JvFormStorage
DescriptionI have a problem with the JvFormStorage when I try to store a property of an object made by me.
To reproduce what I think to be the case, try putting a panel on a form of type MDIChild and anchor it on all sides.
Add the JvFormStorage (with a storage) and add two property to store the height and the width of the panel.
Run the program and maximizes the form child, then close it and reopen it: the panel is larger, why?
Additional InformationSorry for my english
TagsNo tags attached.

Activities

jfudickar

2010-11-22 22:31

developer   ~0018148

Please create a sample app and add it to this case.

2010-11-24 10:19

 

JvFormStorageQuestion.zip (6,020 bytes)

CDametto

2010-11-24 10:21

reporter   ~0018160

Added sample application

obones

2011-06-08 13:52

administrator   ~0018663

As you are storing the size of the form, you should not be storing the size of the panel because it is anchored.
If you don't store the width nor the height, it works just fine.

CDametto

2011-06-08 18:53

reporter   ~0018702

That's right, but I stored the width and the height because my panel is resizable and I should need to preserve the last user customization.
Perhaps I could try to realize a more complex sample with a TSplitter...

jfudickar

2011-06-09 21:24

developer   ~0018712

This problem is realy not so easy to solve. The problem is the restore order in combination with your anchors.

The situation looks like:
1. The panel size is restored and changed
2. The form mdi status is restored and based on this the form is maximized.
3. Based on the form resize in combination with the anchors the panel is resized.


One solution could be to restore the form state before restoring the FormStorage.StoredProps.

Any comments welcome

Regards
Jens

CDametto

2011-06-10 16:27

reporter   ~0018727

It was the solution I originally thought about, but the source code was difficult for me to fix and I realized another issue. If the panel is located on a MDIChild form maximized to the main, and you close the form, change the main size and reopen the form, then you'll not have the same dimension of the form when you closed it, and the restoration of the panel will be wrong, I think...
The point is to have the same form size when you save and restore the
panel dimentions data.
Perhaps you could always normalize the form on closing, before saving the
form and panel sizes, and leave restoration as now, first the form and
the panel sizes, then the form state.
Could it work?
Sorry for my English, I hope I was clear enough.
Thanks for the availability.

jfudickar

2011-06-10 16:43

developer   ~0018728

This will also not work.
The point is to store the distance of panel width to form width, and then restore this.
This could be handled by additional events and maybe the stored values.

This will be the only way to solve the other problem also.

Regards
Jens

jfudickar

2011-06-11 12:27

developer   ~0018740

Hi,

I changed your sample a little bit, and it seems to work now. Hopefully for all situations.

Have a look on it.

Regards
Jens

2011-06-11 12:28

 

JvFormStorageQuestion-Answer.zip (6,067 bytes)

CDametto

2011-06-13 11:03

reporter   ~0018758

Ok, I'll try to adopt this solution.

Thanks

CDametto

2011-06-13 17:14

reporter   ~0018761

Actually I would like to preserve the relationship between the width of the panel and the width of the form, instead of their distance, but I can not. I still have the same problem that the form expands after setting the size of the panel...

jfudickar

2011-06-13 17:34

developer   ~0018762

You can do this in the same way like the distance.

But this is a different behaviour then your anchor behaviour.
As far as I can see the anchor is based on the distance.

Regards
Jens

CDametto

2011-06-14 10:59

reporter   ~0018764

Yes, the anchor is based on the distance, and the expansion is linear and not proportional. I can't restore the proportion on the AfterRestorePlacement event because the width of the form is not yet maximized. I'm thinking that maybe this problem is not due to the component, but I can not find a solution.
Thanks for any suggestions.

jfudickar

2011-06-14 22:42

developer   ~0018765

But you can calculate also the ration. This should work.

Or maybe you create a more complex sample. Because based on your original sample I can't see a problem with my solution.

Regards
Jens

2011-06-16 17:05

 

JvFormStorageNewQuestion.zip (6,890 bytes)

CDametto

2011-06-16 17:07

reporter   ~0018770

Added a new sample

jfudickar

2011-06-19 13:11

developer   ~0018778

Sorry for having no "perfect" news for you.

This is nothing I see to fix on our (jvcl) level.

The problem is that the changing of the window state is happening AFTER the FormShow Event.

You can test this by adding a messagedlg to formshow and formresize (both showing formwidth).
When you set the window state to maximize at design time you see that the formwidth is changed after the formshow (and there is no event to react on).

The only solution is to store the ratio in a form variable and change this ratio every time when the splitter is moved, and restore it every time when the form is resized.

Have a look at my new sample. It seems to solve your problem.

Regards
Jens

2011-06-19 13:12

 

JvFormStorageNewQuestionAnswered.zip (9,867 bytes)

2011-06-21 10:22

 

JvFormStorageResult.zip (6,597 bytes)

CDametto

2011-06-21 10:25

reporter   ~0018796

Your example is very good, I just changed it a little, because I don't want an always proportional resizing, but just at the opening of the form.
Now it works properly for my needs. I added a final sample of the result.
Thank you very much for your time and your help.
Sincerely
Cristiano

jfudickar

2011-06-21 14:50

developer   ~0018799

Good to know. And thanks that you informed us that the problem is solved.

Regards
Jens

Issue History

Date Modified Username Field Change
2010-11-22 12:36 CDametto New Issue
2010-11-22 22:31 jfudickar Note Added: 0018148
2010-11-22 22:31 jfudickar Status new => feedback
2010-11-24 10:19 CDametto File Added: JvFormStorageQuestion.zip
2010-11-24 10:21 CDametto Note Added: 0018160
2011-06-07 17:30 obones Status feedback => acknowledged
2011-06-08 13:52 obones Note Added: 0018663
2011-06-08 13:52 obones Status acknowledged => feedback
2011-06-08 18:53 CDametto Note Added: 0018702
2011-06-09 21:24 jfudickar Note Added: 0018712
2011-06-10 16:27 CDametto Note Added: 0018727
2011-06-10 16:43 jfudickar Note Added: 0018728
2011-06-11 12:27 jfudickar Note Added: 0018740
2011-06-11 12:28 jfudickar File Added: JvFormStorageQuestion-Answer.zip
2011-06-13 11:03 CDametto Note Added: 0018758
2011-06-13 17:14 CDametto Note Added: 0018761
2011-06-13 17:34 jfudickar Note Added: 0018762
2011-06-14 10:59 CDametto Note Added: 0018764
2011-06-14 22:42 jfudickar Note Added: 0018765
2011-06-16 17:05 CDametto File Added: JvFormStorageNewQuestion.zip
2011-06-16 17:07 CDametto Note Added: 0018770
2011-06-19 13:11 jfudickar Note Added: 0018778
2011-06-19 13:12 jfudickar File Added: JvFormStorageNewQuestionAnswered.zip
2011-06-21 10:22 CDametto File Added: JvFormStorageResult.zip
2011-06-21 10:25 CDametto Note Added: 0018796
2011-06-21 14:50 jfudickar Note Added: 0018799
2011-06-21 14:50 jfudickar Status feedback => resolved
2011-06-21 14:50 jfudickar Resolution open => fixed
2011-06-21 14:50 jfudickar Assigned To => jfudickar