View Issue Details

IDProjectCategoryView StatusLast Update
0001860JEDI VCL00 JVCL Componentspublic2006-01-26 00:53
ReporterAlexeiRAssigned Toobones 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Version 
Target VersionFixed in Version3.20 
Summary0001860: JvInterpreter: cannot access form fields
DescriptionI've attached application that creates scripted form.
A form tries to assign some public fields in OnCreate handler, but interpreter exception occurs.
The same with methods works well.
Fix that please!
TagsNo tags attached.

Activities

2004-06-14 09:49

 

InterpreterBug_FormFields.zip (2,392 bytes)

maxp

2004-09-13 03:34

reporter   ~0005225

It seems that only 'published' fields is accessible. May be by design?

ivan_ra

2004-09-14 05:13

developer   ~0005226

Last edited: 2004-09-14 05:15

It's by design. I have solution for this (works on beta1), but I can't check this solution on latest CVS because can't compile JvCore. May be developers will do it?
I will upload solution for beta1: JvInterpreter.zip (JvInterpreter.pas & JvInterpreterFm.pas). New code is marked by ($IFDEF CLASS_FIELDS_SUPPORT}.
This is list of changed routines:

destructor TJvInterpreterAdapter.Destroy;
procedure TJvInterpreterAdapter.ClearSource;
procedure TJvInterpreterUnit.InterpretClass(const Identifier: string);

TJvInterpreterForm: add new field FFieldList: TJvInterpreterVarList;
constructor TJvInterpreterForm.CreateNew
destructor TJvInterpreterForm.Destroy;
procedure TJvInterpreterFm.LoadForm(AForm: TJvInterpreterForm);
function TJvInterpreterFm.GetValue
function TJvInterpreterFm.SetValue

edited on: 09-14-04 05:15

2004-09-14 05:13

 

Interpreter.zip (45,572 bytes)

ivan_ra

2004-09-14 22:17

developer   ~0005227

I missed "raise" statement in TJvInterpreterUnit.InterpretClass:

  FieldsPattern:=TJvInterpreterVarList.Create;
  try
...
  except
    FieldsPattern.Free;
    raise; // <- here
  end;

more correct version of Interpreter.zip uploaded

2004-09-14 22:19

 

Interpreter.zip (45,581 bytes)

2004-09-20 03:38

 

FormFieldsSupport.zip (47,250 bytes)

ivan_ra

2004-09-20 03:59

developer   ~0005240

FormFieldsSupport.zip (JvInterpreter.pas & JvInterpreterFm.pas) - is support for fields in interpreted forms, for latest JVCL(beta2), and without change of interface.
- new code is marked by {$IFDEF CLASS_FIELDS_SUPPORT}
- all fields are public
- property declaration not supported
- there is no control of correspondence between form resources (dfm) and form fields and methods

obones

2005-08-10 03:27

administrator   ~0007767

Is this still applicable on the latest JVCL code ?

ivan_ra

2005-08-18 07:57

developer   ~0007810

Last edited: 2005-08-18 08:04

This is still applicable.
I tested form fields support with JVCL3 release.
I will post new files based on JVCL3 release code (not latest CVS files, because interfase changed - there are new RsArrayToArrayAssignment const, SubStrBySeparator function and so on).
Code still marked with CLASS_FIELDS_SUPPORT comment

And this is new small issue:
TJvInterpreterAdapter can work with same identifiers from different units, for example:
unit1.myProcedure
unit2.myProcedure
But in current realization after "compilation" adapter looses information about units for some identifiers. I added code to store information about unit names. This is functions:
TJvInterpreterAdapter.AddConstEx
TJvInterpreterAdapter.AddExtFunEx
...
TJvInterpreterAdapter.Add...Ex
Look on strings marked with comment: // Ivan_ra (unit control & form designer)
For example:

procedure TJvInterpreterAdapter.AddClassEx(const UnitName: string; AClassType: TClass;
  const Identifier: string; Data: Pointer);
var
  JvInterpreterClass: TJvInterpreterClass;
begin
  JvInterpreterClass := TJvInterpreterClass.Create;
  JvInterpreterClass.FClassType := AClassType;
  JvInterpreterClass.Identifier := Identifier;
  JvInterpreterClass.Data := Data;
  JvInterpreterClass.UnitName := UnitName; // Ivan_ra (unit control & form designer)
  FClassList.Add(JvInterpreterClass);
  FSorted := False; // Ivan_ra
end;

Now compiled code has information about UnitName. This code added to sended file too.

2005-08-18 08:01

 

FormFieldsSupport1.zip (47,892 bytes)

ivan_ra

2005-08-29 00:12

developer   ~0007884

Nevertheless, for me it would be better to change interface:
1. Create new class TJvInterpreterSrcClass with special field/property VarList:TJvInterpreterVarList (public); We also must to add Create/Destroy methods to class to handle this list; May be, Assign method too.
Objects of this class will be members of TJvInterpreterAdapter.FSrcClassList. So, fields information will store in special list, not in data as in my solution
2. Add private field FVarList: TJvInterpreterVarList to TJvInterpreterForm. This field must substitute FMethodList[0] pointer in my solution.
3. See also issue 0003166

ivan_ra

2006-01-25 13:07

developer   ~0008456

This closed in 0003420

obones

2006-01-26 00:53

administrator   ~0008459

As indicated by ivan_ra, this is fixed in 0003420

Issue History

Date Modified Username Field Change
2004-06-14 09:49 AlexeiR New Issue
2004-06-14 09:49 AlexeiR File Added: InterpreterBug_FormFields.zip
2004-09-13 03:34 maxp Note Added: 0005225
2004-09-14 05:13 ivan_ra Note Added: 0005226
2004-09-14 05:13 ivan_ra File Added: Interpreter.zip
2004-09-14 05:15 ivan_ra Note Edited: 0005226
2004-09-14 22:17 ivan_ra Note Added: 0005227
2004-09-14 22:19 ivan_ra File Added: Interpreter.zip
2004-09-20 03:38 ivan_ra File Added: FormFieldsSupport.zip
2004-09-20 03:59 ivan_ra Note Added: 0005240
2005-08-10 03:27 obones Note Added: 0007767
2005-08-10 03:27 obones Status new => feedback
2005-08-18 07:57 ivan_ra Note Added: 0007810
2005-08-18 08:01 ivan_ra File Added: FormFieldsSupport1.zip
2005-08-18 08:04 ivan_ra Note Edited: 0007810
2005-08-29 00:12 ivan_ra Note Added: 0007884
2006-01-25 13:07 ivan_ra Note Added: 0008456
2006-01-26 00:53 obones Status feedback => resolved
2006-01-26 00:53 obones Resolution open => fixed
2006-01-26 00:53 obones Assigned To => obones
2006-01-26 00:53 obones Note Added: 0008459