>>>>>Looks like VFP8 bug with a pageframe to me. Would you please try to replicate?
>>>>>
>>>>>Thanks a lot in advance.
>>>>
>>>>I don't quite see how you create pages. Are you doing it programmatically?
>>>>Btw, if you decide to use BindEvent then where you're going to Unbindevent?
>>>
>>>No, I have a simple pageframe class with PageCount = 0. I added an instance of this class to a form and set PageCount = 2, set pages' names and captions. When I run my form I see a gray "thing" where the pageframe is supposed to be and I do not see an active page. I think I have to add thisform.pgf.ActivePage = 1 in form's Activate to solve the problem.
>>>
>>>Why do you think I have to unbind event? What exactly do you think is a problem?
>>>
>>>Thanks.
>>
>>I vaguely remember some problems with PageCount=0. Could you just set it to 1 in class. You won't use PageCount=0 in actual forms anyway.
>>In regard to unbindevent, I see that Activate should be triggered in some way, i.e. some code should fire once only and not every time when you activate a page. However, I understand that you may code eventhandler to get this functionality. Frankly, I never subclassed pageframes.
>
>Thanks a lot, Edward. Setting the activepage = 1 in form's Activate did fix the problem, as I expected.
Same here with VFP9.
The strangest thing is that if you put your class in Form designer and set the pageCount in properties sheet there is NO PROBLEMS after run the form, but if you put in code:
oForm = CREATEOBJECT([Form1])
oForm.Show()
READ EVENTS
DEFINE CLASS form1 AS form
DoCreate = .T.
Name = "form1"
ADD OBJECT oPages1 AS oPages WITH ;
ErasePage = .T., ;
PageCount = 2, ;
Top = 13, ;
Left = 16, ;
Width = 341, ;
Height = 215, ;
Visible = .t.,;
Name = "oPages1", ;
Page1.Caption = "Page1", ;
Page1.Name = "Page1", ;
Page2.Caption = "Page2", ;
Page2.Name = "Page2"
PROCEDURE atest
AEVENTS(laTest,0)
WAIT WINDOW NOWAIT laTest[1].Name NOCLEAR
ENDPROC
PROCEDURE Init
FOR EACH oPage IN thisform.oPages1.Pages
BINDEVENT(oPage,[Activate],thisform,[aTest],1)
NEXT
ENDPROC
PROCEDURE Destroy
CLEAR EVENTS
ENDPROC
ENDDEFINE
DEFINE CLASS oPages AS pageframe
ErasePage = .T.
PageCount = 0
ActivePage = 0
Width = 241
Height = 165
Name = "oPages"
ENDDEFINE
The result is the same (VFP9). That is the code generated with Class Browser I didn't change anything in it and it is NOT working. If you run the SCX no problems at all.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.