>************************************************** >*-- 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 >**************************************************>