Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Where is the problem?!?!
Message
From
21/02/2003 13:52:57
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Where is the problem?!?!
Miscellaneous
Thread ID:
00756309
Message ID:
00756309
Views:
39
Just copy, paste and run this code (no viruses! :).... Then read after the code.

PUBLIC oForm
LOCAL i, cName
oForm=CREATEOBJECT("Form")
oForm.AddObject('Button', 'commandbutton')
oForm.Button.Visible=.T.
FOR i=1 TO 5
cName=SYS(2015)
oForm.AddObject(cName, "clsContainer")
WITH oForm. &cName
.Top=0
.Left=(i-1)*50+i*20
.Height=300
.Width=60
.Build
.Visible=.T.
ENDWITH
ENDFOR
oForm.Height=300
oForm.Width=300
oForm.Show

DEFINE CLASS clsContainer AS Container
PROCEDURE Build
LOCAL i, j, nSize
nSize=10
FOR i=1 TO this.Width/nSize
FOR j=1 TO this.Height/nSize
cName=SYS(2015)
this.AddObject(cName, "clsCell")
WITH this. &cName
STORE nSize TO .Width, .Height
.Left=(i-1)*nSize
.Top=(j-1)*nSize
.Visible=.T.
ENDWITH
ENDFOR
ENDFOR
ENDPROC
ENDDEFINE

DEFINE CLASS clsCell AS Control
PROCEDURE Click
this.BackColor=this.BackColor+50
ENDPROC
ENDDEFINE

Try to click cells. Is everything OK?
Then, comment 5th line of this code (oForm.Button.Visible=.T.) and run the code again. Does your VFP hung? Mine too... What is this?
Next
Reply
Map
View

Click here to load this message in the networking platform