Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Design time re-size
Message
 
 
À
18/06/2009 10:30:02
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01406083
Message ID:
01406865
Vues:
70
Hi Jim,

To avoid C005 errors did you try adding FOXOBJECT to FOR EACH loop?

>Koen --
>
>Yes, I do have a very special case -- I have a form designed in font size 8, which I would like to use in a presentation with font size 14. (This is my PEM Editor tool). Turns out that the form starts out small enough that it can handle being (almost) doubled in size.
>
>So, below is the little class I've come up with. Drop it on a sample form, and do.
>
> .Run (nn, 8) where nn is the new fontsize
>
>**************************************************
>*-- Class:        changefontsize 
>*-- ParentClass:  custom
>*-- BaseClass:    custom
>*-- Time Stamp:   06/16/09 02:12:02 PM
>*
>*
>DEFINE CLASS changefontsize AS custom
>
>
>	Name = "changefontsize"
>
>
>	PROCEDURE run
>		* Added: 06/16/2009
>		*========================
>
>		Lparameters tnNewFontSize, tnDefaultFontSize
>
>		With This
>			.Update ('Save Anchor', Thisform)
>			.Update ('Change FontSize', Thisform, tnNewFontSize, tnDefaultFontSize)
>			.Update ('Restore Anchor', Thisform)
>		Endwith
>	ENDPROC
>
>
>
>
>	*-- Updates all objects on this form to a new font size -- changing their size and position as well
>	PROCEDURE update
>		* Added: 06/16/2009
>		*========================
>		Lparameters tcStyle, toParent, tnNewFontSize, tnDefaultFontSize
>
>		Local  ;
>			loChild AS Object	,;
>			loParent AS Object
>		Local lbChangeFontsize, lnCount, lnI
>
>		loParent = toParent
>
>		*** JRN 06/16/09 : get count for number of children
>		With loParent
>			Do Case
>				Case Not Pemstatus(loParent, 'Objects', 5)
>					lnCount = 0
>				Case Pemstatus(loParent, 'ControlCount', 5)
>					lnCount = .ControlCount
>				Case Inlist(Lower(.BaseClass),[pageframe])
>					lnCount = .PageCount
>				Case Inlist(Lower(.BaseClass),[grid])
>					lnCount = .ColumnCount
>				Case Inlist(Lower(.BaseClass),[optiongroup],[commandgroup])
>					lnCount = .ButtonCount
>				Otherwise
>					lnCount = 0
>			Endcase
>		Endwith
>
>		*** JRN 06/16/09 : Loop thru children, avoiding potential C5 errors if using For Each
>		If lnCount # 0 And "O" = Type("loParent.Objects(1)")
>			For lnI = 1 To lnCount
>				loChild = loParent.Objects(lnI)
>				This.Update (tcStyle, loChild, tnNewFontSize, tnDefaultFontSize)
>			Endfor
>		Endif
>
>		If Not Pemstatus (loParent, 'Top', 5)
>			Return
>		Endif
>
>		With loParent
>			Do Case
>				Case tcStyle = 'Save Anchor'
>					If Pemstatus (loParent, 'Anchor', 5)
>						.AddProperty ('n_original_anchor', .Anchor)
>						.Anchor = 0
>					Endif
>				Case tcStyle = 'Restore Anchor'
>					If Pemstatus (loParent, 'Anchor', 5)
>						.Anchor = .n_original_anchor
>					Endif
>				Case tcStyle = 'Change FontSize'
>					lbChangeFontsize = Pemstatus (loParent, 'FontSize', 5)
>					If Not Pemstatus (loParent, 'n_original_width', 5)
>						.AddProperty ('n_original_top', .Top)
>						.AddProperty ('n_original_left', .Left)
>						.AddProperty ('n_original_height', .Height)
>						.AddProperty ('n_original_width', .Width)
>						If lbChangeFontsize 
>							.AddProperty ('n_original_fontsize', .FontSize)
>						Endif
>					Endif
>
>					.Top 	= .n_original_top * tnNewFontSize / tnDefaultFontSize
>					.Left 	= .n_original_Left * tnNewFontSize / tnDefaultFontSize
>					.Height = .n_original_Height * tnNewFontSize / tnDefaultFontSize
>					.Width 	= .n_original_width * tnNewFontSize / tnDefaultFontSize
>					If lbChangeFontsize 
>						.FontSize = .n_original_fontsize * tnNewFontSize / tnDefaultFontSize
>					Endif
>			Endcase
>		Endwith
>	ENDPROC
>ENDDEFINE
>*
>*-- EndDefine: changefontsize
>**************************************************
>
>
>
>
>
>>James,
>>
>>quote
>>But it won't change the position of the controls -- as the fontsize grows, I want the form to grow as well, to have all the controls on the form to expand and move proportionally so that, in effect, it looks like it had previously, only larger.
>>unquote
>>
>>Are you sure, that will not only need an intensive trouble with anchors but will also need a very special form design. I would not think of even start to think how that has to be programmed in VFP. Maybe it is a start to make use of the Windows magnifier technique.
>>
>>Do keep me posted when you have skinned this goat.
>>
>>Regards,
>>
>>Koen
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform