Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Difference between forms and class based forms?
Message
From
02/04/2009 12:24:23
 
 
To
24/03/2009 18:03:18
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01391221
Message ID:
01392764
Views:
81
>What's the functional difference between a form and a class based form?
>
>I have seen code like the following enough times to wonder: Why not Do Form ???
>
release _oAnchorEditor
>public _oAnchorEditor
>_oAnchorEditor = newobject('AnchorEditor', 'AnchorEditor.vcx')
>if vartype(_oAnchorEditor) = 'O'
>	_oAnchorEditor.Show()
>else
>	release _oAnchorEditor
>endif vartype(_oAnchorEditor) = 'O'
>
>Thanks

One of the most difference is this:
a form class property it is evaluated the first time only,
a form scx property it is evaluated every time the scx is created.
PUBLIC x,y
x = CREATEOBJECT("formvcx")
x.visible = .T.
CHRSAW(10)
y = CREATEOBJECT("formvcx") && after 10 seconds y return x.datetime
y.visible = .T.

DEFINE CLASS formvcx AS form

	opentime = (DATETIME())
	
	ADD OBJECT text1 AS textbox WITH ;
		Alignment = 3, ;
		Value = (m.THISFORM.opentime), ;
		Height = 23, ;
		Left = 36, ;
		Top = 36, ;
		Width = 204, ;
		Name = "Text1"

ENDDEFINE
if you create the same example with a scx, the datetime it is the time when the scx is created.

Result: into a VCX form you cannot to put a dynamic property into the class properties.
( this is that to do the scx loader )
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform