Date: Tue, 21 Apr 2009 15:24:19 -0400
Reply-To: Dave Scocca <dave@SCOCCA.ORG>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Dave Scocca <dave@SCOCCA.ORG>
Subject: Re: AF Frame/AWS Window Sizes
In-Reply-To: <92BD54B69F8AA446B8446927AAADE7B403F8ECE4@cpc-1.Colorado.local>
Content-Type: text/plain; charset=us-ascii; format=flowed
--On 4/21/2009 12:59 PM -0600 Ken Barz wrote:
> Is there a graceful way to make my AF Frame and AWS window sizes match?
> There seems to be a lot of control about making menus go away and
> removing the ability to maximize, but all I want is a nice snug fit.
You can set the frame to fill the AWS window by running the "Zoom" command
(call execcmdi('Zoom')), although this has some other effects (merging the
frame-window controls with the AWS-window controls, and making all frames
be maximized).
The way to make a frame fill the AWS window without zooming it is slightly
more complex... what you do is
(1) set _frame_.horizontalPosition and _frame_.verticalPosition to 1
(putting the frame at the upper right corner.
(2) call _frame_._wInfo('MaxRow', maxRow) and _frame_._wInfo('MaxCol',
maxCol) to load the maximum possible frame size (in rows and columns) into
the variables MaxRow and maxCol.
(3) If your AWS does not fill the entire screen, read the value of the
AWSDef SAS system option (which will return a string like: "(0 0 80 90)"
meaning that the upper-left of the AWS is at 0, 0 and it takes up 80% of
the screen height and 90% of the screen width.
(4) Reduce maxRow and maxCol to the percentage of their value matching the
returned AWSDEF value--that is, if AWSDef is "(0 0 80 90)", multiply maxRow
by .8 and maxCol by .9--and truncate down to an integer.
(5) Set _frame_.height to maxRow and _frame_.width to maxCol, making the
maximum possible frame size that fits in the AWS window.
If your AWS is running full-screen (AWSDef returns "(0 0 100 100)") you can
skip steps 3 and 4, which is where the complicated stuff comes in.
Basically, the _wInfo() calls for MaxRow and MaxCol assume the AWS is
full-screen when telling you how high/wide the frame could be, and if the
AWS is not full-screen you have to compensate for that before using the
returned values.
In this case, grace is in the eye of the beholder. I have an object which
has a maximizeFrame() method which takes a frame ID as a parameter, so I
only have to have this particular bit of calculation in one place rather
than in every frame.
Dave Scocca