Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Add objects at runtime not working (AGAIN)
Message
From
20/11/2008 08:06:20
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9
OS:
Vista
Miscellaneous
Thread ID:
01363081
Message ID:
01363092
Views:
12
that line (oScaleLine) is not visible either. But I will go back to the drawing board
Thanks
Peter


>You're adding only one object (oScaleLine) to the form. The rest are not the part of the form and wil not be visible. You've to use ADDOBJECT() or NEWOBJECT() forms methods in order to make any new object a part of the form.
>
>>I haven't used adding objects at runtime at a really long time but now twice I tried and failed;
>>the following is supposed to add a time scale to a form like this
>>
>>7 8 9 10
>>|______|______|______| etc
>>and then scale when resized
>>the objects get created and are labelled visible in the debugger but they DON'T show on the form once initialized
>>
>>what could I be doing wrong???
>>
>>This method is called from the init of the form.
>>
>>LOCAL lnWidth,lnNumTicks,lnStratTick,lnTickLen,I
>>lnWidth		= thisform.grd1.Width
>>lnNumTicks	= 17
>>lnStratTick	= 7
>>lnTickLen	= lnWidth/lnNumTicks
>>DIMENSION thisform.aScale[lnNumTicks+1]
>>DIMENSION thisform.aTicksLabel[lnNumTicks+1]
>>FOR I = 1 TO lnNumTicks+1
>>	thisform.aScale[m.I]	= CREATEOBJECT("Line")
>>	thisform.aScale[m.I].top	= 262
>>	thisform.aScale[m.I].height = 12
>>	thisform.aScale[m.I].width	= 1
>>	thisform.aScale[m.I].left	= 3+(m.I-1)*lnTickLen
>>	thisform.aScale[m.I].visible= .t.
>>	
>>	thisform.aTicksLabel[m.I]	= CREATEOBJECT("Label")
>>	thisform.aTicksLabel[m.I].caption	= TRANSFORM(6+m.i)
>>	thisform.aTicksLabel[m.I].height	= 15
>>	thisform.aTicksLabel[m.I].fontname	= 'Arial'
>>	thisform.aTicksLabel[m.I].fontsize	= 8
>>	thisform.aTicksLabel[m.I].fontitalic= .t.
>>	DO CASE
>>	CASE m.I = lnStratTick
>>		thisform.aTicksLabel[m.I].caption	= TRANSFORM(6+m.i)+" am"
>>	
>>	CASE m.I = 12-(lnStratTick+2)
>>		thisform.aTicksLabel[m.I].caption	= TRANSFORM(6+m.i)+" Noon"
>>
>>	CASE m.I = 12-(lnStratTick+2)+ 1
>>		thisform.aTicksLabel[m.I].caption	= TRANSFORM(6+m.i)+" pm"
>>
>>	CASE m.I = lnNumTicks + 1
>>		thisform.aTicksLabel[m.I].caption	= TRANSFORM(6+m.i)+" pm"
>>
>>	OTHERWISE
>>		
>>	ENDCASE
>>	thisform.aTicksLabel[m.I].left	= 3+(m.I-1)*lnTickLen
>>        thisform.aTicksLabel[m.I].visible	= .t.
>>	
>>ENDFOR 
>>thisform.AddObject (oScaleLine,"LIne")
>>WITH thisform.oScaleLine
>>	.top	= 276
>>	.height	= 1
>>	.width	= lnWidth
>>	.left	= 3
>>	.visible= .t.
>>ENDWITH 
>>
>>
>>Thanks again
>>
>>
>>Peter
Peter Cortiel
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform