Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Add objects at runtime not working (AGAIN)
Message
De
20/11/2008 07:30:57
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Add objects at runtime not working (AGAIN)
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Vista
Divers
Thread ID:
01363081
Message ID:
01363081
Vues:
61
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform