Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Design time re-size
Message
From
19/06/2009 15:02:38
 
 
To
18/06/2009 10:30:02
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01406083
Message ID:
01407256
Views:
108
James,

Below is the revised code so that your class will now also work on a form with the style.vcx thanks to Agnes, Naomi and Ian trust you will like it :
* Update procedure
lParameters tcStyle, toParent, tnNewFontSize, tnDefaultFontSize

local  ;
	loChild as object	,;
	loParent as object, ;
	llHidden, ;
	lnMem, ;
	lnCount, ;
	lnI, ;
	lbChangeFontsize

local Array laMembers[1]

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
	*** check for Hidden props thanks to Agnes Beste
	lnMem = 0
	lnMem=amembers(laMembers,loParent,0,'H')
	if lnMem> 0
		llHidden = .f.
		llHidden = iif(ascan(laMembers,'TOP')>0,.t.,llHidden)
		llHidden = iif(ascan(laMembers,'LEFT')>0,.t.,llHidden)
		llHidden = iif(ascan(laMembers,'HEIGTH')>0,.t.,llHidden)
		llHidden = iif(ascan(laMembers,'WIDTH')>0,.t.,llHidden)
	endif
	do case
		case tcStyle = 'Save Anchor'
			if pemstatus (loParent, 'Anchor', 5)
				**		Naomi  and 	Ian Simcock = using the AddProperty() function and not .AddProperty Method
				addproperty (loParent,'n_original_anchor', .anchor)
				.anchor = 0
			endif
		case tcStyle = 'Restore Anchor'
			if pemstatus (loParent, 'Anchor', 5) and pemstatus(loParent,'n_original_anchor',5)
				.anchor = .n_original_anchor
			endif
		case tcStyle = 'Change FontSize'
			lbChangeFontsize = Pemstatus (loParent, 'FontSize', 5)
			if not pemstatus (loParent, 'n_original_width', 5) and !llHidden
					addproperty (loParent, 'n_original_top', .top)
					addproperty (loParent, 'n_original_left', .left)
					addproperty (loParent, 'n_original_height', .height)
					addproperty (loParent, 'n_original_width', .width)
					if lbChangeFontsize
						addproperty (loParent,'n_original_fontsize', .fontsize)
					endif
			endif
			
			if !llHidden
				.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
			endif
						
	endcase
endwith
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform