AAron@image.soe.clarkson.edu (AAron nAAs) (08/14/90)
Neither the PROGRAMMER'S GUIDE TO GEM or the MWC manual explain wind_calc() very clearly. This may be what I need. I have an object structure I created with a RCS, and I want to put it into a window that fits around it exactly. I named the lowest (largest) box, and found out it's width and height, and gave them to wind_create() to come up with the correct size. When I put my object into it, I lost the bottom of the object. (I am clipping outside the window) I have figured that NAME bar in the window is taking up space I did not count on. I wanted to make the window the size of my object plus the HEIGHT of the NAME bar, so that I can fit my WHOLE object into the window. How do I figure out how big the NAME bar is? (I want to FIGURE OUT how tall the window is rather than hard coding a height) Or what is the easiest way of figuring out how big to open my window as? AAron nAAs AAron@sun.soe.clarkson.edu
leo@ehviea.ine.philips.nl (Leo de Wit) (08/15/90)
In article <1990Aug14.030733.21587@sun.soe.clarkson.edu> AAron@image.soe.clarkson.edu (AAron nAAs) writes: |Neither the PROGRAMMER'S GUIDE TO GEM or the MWC manual explain wind_calc() |very clearly. This may be what I need. It is. | |I have an object structure I created with a RCS, and I want to put it into a |window that fits around it exactly. I named the lowest (largest) box, and |found out it's width and height, and gave them to wind_create() to come up |with the correct size. | |When I put my object into it, I lost the bottom of the object. |(I am clipping outside the window) | |I have figured that NAME bar in the window is taking up space I did not count |on. I wanted to make the window the size of my object plus the HEIGHT of the |NAME bar, so that I can fit my WHOLE object into the window. | |How do I figure out how big the NAME bar is? |(I want to FIGURE OUT how tall the window is rather than hard coding a height) |Or what is the easiest way of figuring out how big to open my window as? It seems like you are confusing the total window area with the work area part of the window (in which your object has to be drawn). This is how to do it: use your object's sizes as the window work area sizes (as you will probably know x and y can be determined by objc_offset() and the width and height by using the OBJECT's .width and .height members). From this you can calculate the true window sizes using wind_calc(). Then you can create and open the window with these sizes. Here is how to use wind_calc() (as far as I can recall without the docs; maybe I mixed up the order of wctype and winflags): #include <portab.h> #include <gemlib.h> /* For Lattice, your includes might differ */ WORD winflags = NAME|FULLER|CLOSER; /* for example */ WORD work_x, work_y, work_w, work_h, win_x, win_y, win_w, win_h; WORD retval; /* Calculate work_.. from your object's sizes, then */ retval = wind_calc(WC_BORDER,winflags, work_x, work_y, work_w, work_h, &win_x, &win_y, &win_w, &win_h); /* and now proceed to create and open using winflags and win_.. */ Wind_calc can also be used to do the reverse: calculate the work area sizes from the total window sizes; in that case WC_WORK should be used instead of WC_BORDER. The winflags are needed for GEM to detemine the window's accessories size (name/info fields, scrollbars), and should be the same as used in the subsequent wind_open(). Hope this helps, Leo.