PDA

View Full Version : Form Import with Base Classes



robertjacobs
2012-11-12, 16:31
I created a project with a single prg file and a single form using baseclass controls. Why does the generated code show DEFINE CLASS for base classes and why are there two DEFINE CLASS LABEL sections?

************************************************** ******************************
*
* File created by Lianja Version 1.0.0 (beta10)
* Converted on 11/12/2012 at 16:21:52
*
************************************************** ******************************

FORM1_3n50ympvf = createobject("FORM1")

** Make the form visible.
FORM1_3n50ympvf.show(1)


////////////////////////////////////////////////////////////////////////////////
define class FORM1 as form

** Children
add object Label1 as label
add object Label2 as label
add object Command1 as commandbutton

** Properties
DoCreate = .T.
Caption = "Form1"
Name = "FORM1"

enddefine


////////////////////////////////////////////////////////////////////////////////
define class label

** Properties
Caption = "Label1"
Height = 17
Left = 72
Top = 48
Width = 40
TabIndex = 1
Name = "Label1"

enddefine


////////////////////////////////////////////////////////////////////////////////
define class label

** Properties
Caption = "Label2"
Height = 17
Left = 226
Top = 48
Width = 40
TabIndex = 2
Name = "Label2"

enddefine


////////////////////////////////////////////////////////////////////////////////
define class commandbutton

** Properties
Top = 144
Left = 120
Height = 27
Width = 84
Caption = "Command1"
TabIndex = 3
Name = "Command1"

** Methods
PROCEDURE Click
THISFORM.RELEASE

ENDPROC


enddefine

barrymavin
2012-11-12, 19:54
Thats a very good question. Please submit a ticket and attach the scx you imported and we will take a look.

robertjacobs
2012-11-13, 07:38
OK done. My intent is to start from the ground up by testing base classes before using a subclass library.

robertjacobs
2012-11-13, 16:03
In addition to base controls - This issue also occurs for subclass controls (i.e. scp controls based on vcp controls).

lazyfox
2012-11-14, 04:52
I created a project with a single prg file and a single form using baseclass controls. Why does the generated code show DEFINE CLASS for base classes and why are there two DEFINE CLASS LABEL sections?

Hi Robert,

I fixed and enhanced the importers from B9 up a bit and Lianja team also added some tiny changes to that again.
The use case you describe was not in my test cases, as from habit I declare a subclass for every vfp base class in vcx.
Then there is the very vfp-specific pseudo subclassing behaviour, which stems ONLY from the way vcx are handling
the adding of objects in the container - and in the importers I just followed the basic Lianja script design, which used
only .AddObject() and not ADD OBJECT, but this might be changed if Lianja capabilities in ADD OBJECT grow.

Perfectly possible that I screwed up that issue, as the linking and naming are delicate,
not well designed in vfp and among the things I tweaked a bit,
but also possible that this special use cases was not working from start.
Clearly missing from my test cases ;-)

Currently swamped, but perhaps next week I will look at Lianja importrs and the changes -
I have a more elaborate multi-vcx-scx scenario planned to be errorfree and adding your vcx/scx
to the test cases will help guard against such stuff. So pls. send a zip of the needed files to me as well.

regards

thomas

barrymavin
2012-11-14, 05:51
In fact the importers were changed to use ADD OBJECT in Beta10. The issue is with embedded vcx files which is a bit of a dogs dinner in the VFP scx files.

robertjacobs
2012-11-14, 08:27
I am not sure if I need to send any files since this problem is very straight forward to duplicate. Simply import a project with a form and a class library and you should get the same results. The code generated for the class libary looks fine but the code generated for the form is messed up regardless to whether or not the form using base or sub classes.

One other thing I noticed too. When I imported a project with two forms it only imported the first form - The second form in the project was ignored. Thanks.

lianjasupport
2012-11-14, 08:38
Yes it's on our todo list to take a look at.