[M3devel] how to obtain screen size of a FormsVBT.T

Randy Coleburn rcoleburn at scires.com
Thu Jun 12 07:26:09 CEST 2008


Using Trestle / FormsVBT / et al, I want to be able to place a new window in the center of the screen.
 
Trestle.Overlap() seems to be the only way I've seen where you can specify the location of the window.
 
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.
 
Here is the way I am using to find out the middle of the screen:
   trestle := Trestle.Connect(NIL);
   s := Trestle.GetScreens(trestle);
   middle := Rect.Middle(s[0].dom);
Not sure if this is the best way, but it seems to work.
 
Now, if I have built a FormsVBT.T, say via v := NEW(FormsVBT.T).initFromRsrc(...),
I then call Trestle.Attach(v, trestle);
>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.
 
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:
   nw := Point.Sub(middle, Point.FromCoords(hsize DIV 2, vsize DIV 2);
   Trestle.Overlap(v, s[0].id, nw);
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.
 
I'd appreciate any insight anyone can give.
 
Regards,
Randy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20080612/66b45e4c/attachment-0001.html>


More information about the M3devel mailing list