*** code in the custom resize of the master container WITH .conHeader *** put the header at the top, left corner of conGridWin, *** offset by the requirement to show the special effect .Left = m.lnInset .Top = m.lnInset *** expand the header's width to fill conGridWin .Width = THIS.Width - (m.lnInset * 2) m.lnConHWidth = .Width *** move the resize buttons to the right side of conHeader WITH .cmdMax .Left = m.lnConHWidth - .Width - 2 m.lnCmdMinLeft = .Left - (.Width + 1) .REFRESH() ENDWITH WITH .cmdResize .Left = m.lnCmdMinLeft m.lnCmdMinLeft = .Left - (.Width + 1) .REFRESH() ENDWITH WITH .cmdMin .Left = m.lnCmdMinLeft .REFRESH() ENDWITH *** resize the label to fill the header, but not cover resize buttons WITH .lblHeader .Width = m.lnCmdMinLeft - (.Left + 10) ENDWITH ENDWITH *** grid takes the space remaining .grdGrid.conResize()Aside from this exception, your code will come together faster and run cleaner if you follow the general guideline that each component is responsible for itself.
WITH THIS.PARENT THIS.LEFT = .conHeader.LEFT THIS.TOP = .Top + .conHeader.HEIGHT THIS.WIDTH = .conHeader.Width THIS.HEIGHT = .HEIGHT - .conHeader.HEIGHT ENDWITHAnother temptation is going to be putting all of this resizing stuff in the Refresh event(s). Bad idea. Refresh() is called by all kinds of things and your code will be firing all the time. While tracing through legacy code, I've seen the same Refresh() code called as many as six times for one resize trigger. You may even get into situations where there are recursive calls, causing a tight loop effect. Instead, create a new method that's used explicitly to resize the container and its components. Then you can call the VFP default Refresh() within your custom (container) refresh, which allows the VFP base class events to do their stuff.