+1 for what the others said. Have you also included the procedure declaration in the interface section so it is visible to the child forms ?
Cheers D David Moorhouse (BCom) | Principal Software Engineer - HealthOne Pegasus Health (Charitable) Ltd P: 03 353 0871 | W: www.pegasus.org.nz<http://www.pegasus.org.nz/> E: [email protected]<mailto:[email protected]> PO Box 741, Christchurch 8140 160 Bealey Ave, Christchurch 8014 [cid:[email protected]] From: [email protected] [mailto:[email protected]] On Behalf Of Barry Neale Sent: Wednesday, 12 October 2016 9:11 a.m. To: NZ Borland Developers Group - Delphi List Subject: Re: [DUG] Procedure run from main program Wallace it appears that all the procedure is completely self contained, in that it only references passed parameters. Why not just put it in it's own unit (or a common utilities unit) and include it in any form that needs it, rather than having it in the mainform unit On Tue, Oct 11, 2016 at 5:26 PM, Marshland Engineering <[email protected]<mailto:[email protected]>> wrote: I'm back on the window page scaling for various forms in my project. This code works quite well. It needs to reside in the main form. I can't get the syntax right to be able to call it from a child form. Any suggestions? procedure FormScale (rHeiScale:real; rWidScale:real; sForm:tForm); var i:integer; rWidth,rHeight:real; begin with sForm do begin rHeight:=rHeiScale*(Screen.Height/Height); // Scale form rWidth:=rWidScale*(Screen.Width/Width); Height:=Round(Height*rHeight); Width:=Round(Width*rWidth); Left:=Round((Screen.Width-Width)/2); // Center form Top:=Round((Screen.Height-Height)/2); for i:=0 to componentcount-1 do if Components[i] is TControl then begin TControl(Components[i]).Top := Round(TControl(Components[i]).Top*rHeight); TControl(Components[i]).Width := Round(TControl(Components[i]).Width*rWidth); TControl(Components[i]).Height := Round(TControl(Components[i]).Height*rHeight); TControl(Components[i]).Left := Round(TControl(Components[i]).Left*rWidth); end; end; end; _______________________________________________ NZ Borland Developers Group - Delphi mailing list Post: [email protected]<mailto:[email protected]> Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to [email protected]<mailto:[email protected]> with Subject: unsubscribe [http://snow.pegasus.org.nz/wp-content/uploads/2016/10/moving_footer.jpg] ******************************************************************************** This email or attachment(s) may contain confidential or legally privileged information intended for the sole use of the addressee(s). Any use, redistribution, disclosure, or reproduction of this message, except as intended, is prohibited. If you received this email in error, please notify the sender and erase all copies of the message, including any attachments. Any views or opinions expressed in this email (unless otherwise stated) may not represent those of Pegasus Health Ltd. ********************************************************************************
_______________________________________________ NZ Borland Developers Group - Delphi mailing list Post: [email protected] Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to [email protected] with Subject: unsubscribe
