Hi I just realised what your issue might be. Is it that forms created from the main form cant call methods in the main form because of Uses clause recursion? If so why not put this code in its own unit can have the main form and child forms all using that unit? Alternatively we have our own TForm inherited base class that our forms inherit from, we put code like this in that base class. Alteratively you can often put one in the top Uses clause (just after interface) and the other in a Uses clause after implementation, although this can be a bit yuk.
Hope that helps. On 12/10/2016 9:02 AM, Robert Martin wrote: > Hi > > Why can't you call it? What is the error message / problem? > > > > On 11/10/2016 5:26 PM, Marshland Engineering 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] >> Admin: http://delphi.org.nz/mailman/listinfo/delphi >> Unsubscribe: send an email to [email protected] with >> Subject: unsubscribe >> >> >> ----- >> No virus found in this message. >> Checked by AVG - www.avg.com >> Version: 2016.0.7797 / Virus Database: 4656/13188 - Release Date: 10/11/16 >> >> > _______________________________________________ > 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 > > > ----- > No virus found in this message. > Checked by AVG - www.avg.com > Version: 2016.0.7797 / Virus Database: 4656/13188 - Release Date: 10/11/16 > > _______________________________________________ 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
