View Issue Details

IDProjectCategoryView StatusLast Update
0003420JEDI VCL00 JVCL Componentspublic2006-01-17 13:26
Reporterivan_raAssigned Toobones 
PrioritynormalSeverityfeatureReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.00 
Target VersionFixed in Version3.20 
Summary0003420: JvInterpreter: Form fields and methods support
DescriptionJvInterpreter do not supports access to form fields and methods. This is form script example:

type
  TTestForm = class(TForm)
    Memo1 : TMemo;
  public
    IntegerField: integer;
    procedure ShowMemoContext
  end;

var
  TestForm : TTestForm;

implementation

procedure TTestForm.ShowMemoContext;
begin
  ShowMessage(Memo1.Lines.Text);
end;

When you call this method from form event it's works fine. But it not works outside of form:

procedure main;
begin
  TestForm := TTestForm.Create(nil);
  TestForm.Memo1.Lines.Text:='Hello world!';
  TestForm.ShowMemoContext; // not works
end;

Also not works read/write form fields as this:
  TestForm.IntegerField:=1;

I have solution for this case (look at mantis 0003166). It does not changes interface section of units JvInterpreter.pas and JvInterpreterFm.pas, but used tricks are not "pretty nice". More nice decision demands little change of interface (1 new field and changing of 1 method and 1 property).
Now (in jvcl 3.1) interface sections already changed. So, before 3.2 out, I can introduce new "nice" decision (with interface change) to implement TForm fields and methods support.
This decision already works in my projects.
Does anybody interested of this?
TagsNo tags attached.

Activities

obones

2006-01-08 12:02

administrator   ~0008344

Please go ahead and don't be afraid of changing the interface, we do it as often as needed.

ivan_ra

2006-01-10 07:07

developer   ~0008363

OK. This is my donation. This is key moments:
1) TJvInterpreterClass extended: added ClassFields list and support for it (create,Destroy). TJvInterpreterAdapter.FSrcClassList now is list of TJvInterpreterClass.
2) Extended TJvInterpreterVarList (added method "assign")
3) Extended TJvInterpreterAdapter.FindFunDesc, AddSrcFun, AddSrcFunEx (added ClassIdentifier - for class methods support)
4) jvInterpreter.pas uses JvInterpreterFm.pas - for class methods support (we need access to TJvInterpreterForm.ClassIdentifier and UnitName
5) Added some code into TJvInterpreterAdapter.ClearSource
6) Added some code into TJvInterpreterAdapter.Assign - look at comments
7) Added missed "UnitName" parameter into some Add...Ex functions
8) Little change of TJvInterpreterUnit.InterpretFunction because AddSrcFun changed
9) Changed TJvInterpreterUnit.InterpretClass - this is key moment for class fields support
10) Changed TJvInterpreterUnit.GetValue - this is key moment for class methods support (here we need access to TJvInterpreterForm.ClassIdentifier and UnitName)
11) TJvInterpreterForm now has FFieldList. Added support for it in Create and Destroy methods)
11) Changed TJvInterpreterFm.LoadForm - copy class field structure into FieldList
12) Added class fields support into TJvInterpreterFm.GetValue and TJvInterpreterFm.SetValue

2006-01-10 07:08

 

JvInterpreter.zip (48,299 bytes)

obones

2006-01-10 07:16

administrator   ~0008364

Does this include changes required for issue 0003333 ?

ivan_ra

2006-01-10 07:32

developer   ~0008365

No, this is independed issues. 3333 is only fix of wrong extending of JvInterpreterParser.pas.
My donation is changing JvInterpreter.pas and JvInterpreterFm.pas. I applyed it to latest CVS

Not "nice" paragraph 4) (jvInterpreter.pas uses JvInterpreterFm.pas ), but without it we must to dublicate part of TJvInterpreterUnit.GetValue code in TJvInterpreterFm.GetValue.GetFromForm

obones

2006-01-17 13:26

administrator   ~0008398

This is now in CVS.
Please, next time, do not put "// ivan_ra" comments everywhere, this is not the usage for the JVCL.

Issue History

Date Modified Username Field Change
2006-01-06 03:05 ivan_ra New Issue
2006-01-08 12:02 obones Note Added: 0008344
2006-01-08 12:02 obones Status new => feedback
2006-01-10 07:07 ivan_ra Note Added: 0008363
2006-01-10 07:08 ivan_ra File Added: JvInterpreter.zip
2006-01-10 07:16 obones Note Added: 0008364
2006-01-10 07:32 ivan_ra Note Added: 0008365
2006-01-17 13:26 obones Status feedback => resolved
2006-01-17 13:26 obones Resolution open => fixed
2006-01-17 13:26 obones Assigned To => obones
2006-01-17 13:26 obones Note Added: 0008398