Hi,
i already know, it's very strange, but ... when i call
FormSize1.SaveFormSettings;
with Location := plIniFile all is fine.
when i set Location := plDatabase , at lines 597 .. of your source code,
if DataBinding.FieldPosX <> '' then
begin
fld := FindField(DataBinding.FieldPosX);
if Assigned(fld) then
fld.AsInteger := (Owner as TForm).Left;
i have an exception "Invalid class typecast" at line
fld.AsInteger := (Owner as TForm).Left;
because "(Owner as TForm)" doesn't works.
When i use the debugger, i see that Owner is the form, the Name is the right name, ecc..
The only "particular" thing is that Owner is a MDIChild form, could it be this the reason ? but apparently i have the same problem with a normal form.
Thanks
Arnaldo
Does it help in your app when you change this to:
?
Hi Bruno,
no, the exception remains. I'm sorry, i had already made this test, i forgot to tell you this thing.
other tests include putting
i := (Owner as TCustomForm).Left;
where i is a Integer (no success)
If i change the instruction to (adding my unit to Uses)
i := (Owner as TMyForm).Left;
the exception remains the same.
I also tested using
FormSize1.SaveFormSettings;
saving the values explicitly, without closing the form.
Bruno, i think i've found...
I think the instruction
with FDataLink.DataSource.DataSet do
"changes" the Owner property used in that context.
if i change the instruction to
(Self.Owner as TForm).Left;
is all fine.
Good catch!
We've fixed this. Fix will be in the next release.
Hi, another problem of the same kind.... I have many forms (each one with a TFormSize component) and one dataset in a datamodule, that connects the TFormSize components to my database.
at line 594 of TFormsize.pas, there is
fld := FindField(DataBinding.FieldFormName);
if Assigned(fld) then
fld.AsString := Owner.Name;
also in these instructions the "Owner" is the property of the dataset component, not the TFormsize component. So, in the database i have in the FIELDFORMNAME field with the name of the datamodule, not the name of the form that contanis TFormSize.
Regards, ciao !
Arnaldo
You're correct! Thanks for pointing out. We've fixed this now.