<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-15">
<META content="MSHTML 6.00.6000.16674" name=GENERATOR></HEAD>
<BODY style="MARGIN: 4px 4px 1px; FONT: 10pt Tahoma">
<DIV>Using Trestle / FormsVBT / et al, I want to be able to place a new window in the center of the screen.</DIV>
<DIV> </DIV>
<DIV>Trestle.Overlap() seems to be the only way I've seen where you can specify the location of the window.</DIV>
<DIV> </DIV>
<DIV>Now, the problem I am having is how to determine the size of a particular FormsVBT.T instance so that I can compute where it should go on the screen. It seems that before the FormsVBT.T is actually displayed on the screen that its dimensions aren't readily visible.</DIV>
<DIV> </DIV>
<DIV>Here is the way I am using to find out the middle of the screen:</DIV>
<DIV> trestle := Trestle.Connect(NIL);</DIV>
<DIV> s := Trestle.GetScreens(trestle);</DIV>
<DIV> middle := Rect.Middle(s[0].dom);</DIV>
<DIV>Not sure if this is the best way, but it seems to work.</DIV>
<DIV> </DIV>
<DIV>Now, if I have built a FormsVBT.T, say via v := NEW(FormsVBT.T).initFromRsrc(...),</DIV>
<DIV>I then call Trestle.Attach(v, trestle);</DIV>
<DIV>From this point onward, all the methods I have used to try and find out the dimensions of "v" don't seem to work reliably.</DIV>
<DIV> </DIV>
<DIV>If I could find out the horizontal (hsize) and vertical (vsize) dimensions of "v", I could make the following calls to place "v" in the center of the screen:</DIV>
<DIV> nw := Point.Sub(middle, Point.FromCoords(hsize DIV 2, vsize DIV 2);</DIV>
<DIV> Trestle.Overlap(v, s[0].id, nw);<BR></DIV>
<DIV>Indeed, if I make an educated guess about hsize and vsize the window is placed properly. But, of course, I need to reliably determine the size of an arbitrary window at runtime.</DIV>
<DIV> </DIV>
<DIV>I'd appreciate any insight anyone can give.</DIV>
<DIV> </DIV>
<DIV>Regards,</DIV>
<DIV>Randy</DIV></BODY></HTML>