Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can a Page object init() event not occur???
Message
From
07/01/2009 04:49:56
 
 
To
07/01/2009 03:55:22
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01371589
Message ID:
01371594
Views:
14
>>Hi,
>>
>>I intend to create a PageFrame which when drop on a form it starts with ZERO page
>>Then when I increase its PageCount property from 0 to N (>0), there will be N pages added which are
>>all based on a page class of mine (instead of the ordinary VFP Page class)
>>The below is what I have done:
>>
>>
>>**************************************************
>>*-- Class:        pagtest (i:\vfp9\work\text.vcx)
>>*-- ParentClass:  page
>>*-- BaseClass:    page
>>*-- Time Stamp:   01/07/09 04:05:14 PM
>>*
>>DEFINE CLASS pagtest AS page
>>	Caption = "Page1"
>>	Height = 199
>>	Width = 199
>>	*-- XML Metadata for customizable properties
>>	_memberdata = ""
>>	Name = "pagtest"
>>ENDDEFINE
>>*
>>*-- EndDefine: pagtest
>>**************************************************
>>
>>
>>**************************************************
>>*-- Class:        pgftest (i:\vfp9\work\text.vcx)
>>*-- ParentClass:  pageframe
>>*-- BaseClass:    pageframe
>>*-- Time Stamp:   01/07/09 04:06:14 PM
>>*
>>DEFINE CLASS pgftest AS pageframe
>>	ErasePage = .T.
>>	MemberClassLibrary = "text.vcx"
>>	MemberClass = "pagtest"
>>	PageCount = 0
>>	ActivePage = 0
>>	Width = 241
>>	Height = 169
>>	*-- XML Metadata for customizable properties
>>	_memberdata = ""
>>	Name = "pgftest"
>>ENDDEFINE
>>*
>>*-- EndDefine: pgftest
>>**************************************************
>>
>>
>>I then drop an instance the pgftest on a form, increase is PageCount to 2 and run the form.
>>At first everthing seems OK, until I add codes to the Init() method of the pages.
>>
>>Whatever custom code that I place in the Init() method of the pages inside that pgftest, say a MessageBox([Hello]), the code simply won't run, as though the initializatoin process simply skip the ini methods of the pages.
>>
>>Isn't MemberClass property is where I define the default member of the PageFrame?
>>Would anyone kindly tell me what have I done wrongly?
>
>None .
>it is on VFP documentation.
>
>Note
>On an .scx form, if you add instantiation code to the member class's Init event, Visual FoxPro disregards that code and only the Init code for the member class definition runs. However, with visual class library (.vcx) forms, Visual FoxPro creates a true subclass. You can safely add instantiation code for other events such as Click.
>


I test again my pgfText class by removing the MemberClass (and of course the MemberClassLibrary as well), reseting it to the default, I notice the codes in the Init() of pages will run.

I am using VFP 9, but I couldn't locate anything from VFP Doc regarding "Visual FoxPro disregards code" in member class...
For the .scx form case, I suppose VFP will disregard custom code in Init() event of member (in my case the page) provided it is one explicitly set with the MemberClass property, am I right?

Btw, I notcie that codes in other event like Activate() will not be disregarded by VFP even if it belongs to a member specified by the MemberClass property. I really could not understand why VFP only disregard Init() event. Besides Init(), is there any more event which will also be disregard by VFP?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform