Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Add objects at runtime not working (AGAIN)
Message
De
20/11/2008 08:29:39
 
 
À
20/11/2008 08:13:30
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Vista
Divers
Thread ID:
01363081
Message ID:
01363098
Vues:
17
this works:
	x1="oLine"+TRANSFORM(m.i)
	*thisform.aScale[m.I].AddObject("Line")  &&&	= CREATEOBJECT("Line")
	thisform.AddObject(x1,"line")
	thisform.&x1..width=10
can that be done without macro substitution?




>>that line (oScaleLine) is not visible either. But I will go back to the drawing board
>>Thanks
>>Peter
>
>I tried this and it gives an error 1925:
>
thisform.aScale[m.I].AddObject("Line")  &&&	= CREATEOBJECT("Line")
>
>
>>
>>
>>>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform