I'm trying to keep my FORMs tidy by hiding unused objects and moving others up to fill these spaces.
The particular FORM that I'm having trouble with has a pageframe. Within that there's a series of pages. Within those there's a series of objects, mostly containers.
Within the .INIT event for container A, we decide whether it's needed. If it isn't, then it gets hidden with a
.VISIBLE = .F.
Let's suppose that container B is just below this. It is needed, so the .VISIBLE property is set as .T.
Then what I'm trying to do is within the .INIT event. The code looks like
FOR EACH loObject1 IN THIS.Objects
IF .NOT. loObject1.Visible
FOR EACH loObject2 IN THIS.Objects
IF ( loObject2.Top >= loObject1.Top + loObject1.Height )
loObject2.Top = loObject2.Top - loObject1.Height
That all seems to work - tracing it through with DEBUG certainly re-positions container B higher up the window.
But after it's gone through that process, and after it has come out of the page's INIT event, then the object position springs back to its original value.