Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Change form properties from another form
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01588477
Message ID:
01588482
Views:
51
>I have a main form that fills the FoxPro screen. It opens a second form that covers the bottom-right corner of the main form.
>When I size the FoxPro window the main form resizes correctly based on the "resize" method, but how can I reference the second form's "resize" method to change it?

You can add a reference of the child form in the parent form and then move it in the resize event of the parent form, something like the following (warning, I just wrote this quickly without thinking too much, just to give you a starting point)
public loForm

loForm		= CreateObject('myForm')
loForm.Show()



define class myForm as Form
	oChildForm		= null
	BorderStyle		= 3
	
	procedure Resize()
		DoDefault()
		this.setChildPosition()
	endproc

	procedure Destroy()
		if Type('this.oChildForm.Name') = 'C'
			this.oChildForm.Release()
		endif
	endproc
	
	procedure setChildPosition()
		with this.oChildForm as Form
			.Top			= this.Height + this.Top - .Height - 1
			.Left			= this.Width + this.Left - .Width - 1
		endwith
	endproc
		
	function init() as Boolean
		this.oChildForm		= CreateObject('Form')
		with this.oChildForm as Form
			.Name			= 'ChildForm'
			.AlwaysOnTop		= .t.
			.Height			= 40
			.Width			= 100
			.BorderStyle		= 1
			.TitleBar		= 0
			.BackColor		= 127
			.BorderStyle		= 0
			.NewObject('txtStatus', 'TextBox')
			.txtStatus.Left		= 1
			.txtStatus.Top		= 1
			.txtStatus.Width	= .Width - 2
			.txtStatus.Value	= 'This is a bogus Status'
			.txtStatus.Visible	= .t.
		endwith
		this.setChildPosition()
		show window (this.oChildForm.Name) in window (this.Name)
		return .t.
	endfunc
enddefine
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform