[comp.sys.amiga.tech] Determining Window Border Widths

murphy@pur-phy (William J. Murphy) (04/21/89)

With the ability to use fonts other than Topaz 80 in different
windows, I am wondering how the system (Intuition in particular)
determines the width of borders.

  Is there a function call that can be made to find the height 
of the top border?  If so, what is it? If not, What about
looking at the window structure, I can't remember right now, but
I recall seeing a structure which contains the TextSize. 

  Is it something like font height + 2 = border height?  

I assume that the standard window has side and bottom borders of
width and height 1 pixel.  Is this correct?

Any and all answers are appreciated. Please e-mail to cut traffic.
Thanks,
Bill Murphy
murphy@newton.physics.purdue.edu

cmcmanis%pepper@Sun.COM (Chuck McManis) (04/23/89)

In article <2164@pur-phy> murphy@pur-phy (William J. Murphy) writes:
>With the ability to use fonts other than Topaz 80 in different
>windows, I am wondering how the system (Intuition in particular)
>determines the width of borders.

Magically, you don't need to know. Instead, you can get the information
*after* intuition has figured out all of the borders by looking at the 
fields in the window structured named :
	BorderLeft, BorderRight, BorderTop, BorderBottom

These contain the border sizes. 

>I assume that the standard window has side and bottom borders of
>width and height 1 pixel.  Is this correct?

No. Try it and see.

Let me again reccomend to new and experienced Amiga programmers alike,
read the include files. There is lots of "neat" stuff in there.


--Chuck McManis
uucp: {anywhere}!sun!cmcmanis   BIX: cmcmanis  ARPAnet: cmcmanis@sun.com
These opinions are my own and no one elses, but you knew that didn't you.
"A most excellent barbarian ... Genghis Kahn!"

acs@pccuts.pcc.amdahl.com (Tony Sumrall) (04/27/89)

In article <100572@sun.Eng.Sun.COM> cmcmanis@sun.UUCP (Chuck McManis) writes:
>In article <2164@pur-phy> murphy@pur-phy (William J. Murphy) writes:
>>With the ability to use fonts other than Topaz 80 in different
>>windows, I am wondering how the system (Intuition in particular)
>>determines the width of borders.
>
>Magically, you don't need to know. Instead, you can get the information
>*after* intuition has figured out all of the borders by looking at the 
>fields in the window structured named :
>	BorderLeft, BorderRight, BorderTop, BorderBottom
>
>These contain the border sizes. 

True but they only contain that information *after* the window has been
opened.  There are times that it would be nice to have this info *before*
you open the window (like, so you could set the window's size prior to
the OpenWindow() call).

Maybe this qualifies as a 1.4 wish?

inews fodder inews fodder inews fodder inews fodder inews fodder
inews fodder inews fodder inews fodder inews fodder inews fodder
inews fodder inews fodder inews fodder inews fodder inews fodder
inews fodder inews fodder inews fodder inews fodder inews fodder
inews fodder inews fodder inews fodder inews fodder inews fodder
-- 
Tony Sumrall acs@pccuts.pcc.amdahl.com <=> amdahl!pccuts!acs

[ Opinions expressed herein are the author's and should not be construed
  to reflect the views of Amdahl Corp. ]

cmcmanis%pepper@Sun.COM (Chuck McManis) (04/29/89)

In article <783@pccuts.pcc.amdahl.com> (Tony Sumrall) writes:
>  ...  There are times that it would be nice to have this info *before*
> you open the window (like, so you could set the window's size prior to
> the OpenWindow() call).

When? I have been thinking about it and can't come up with a time when
you need this information before you open the window. You could always 
open the window, check the borders and then resize it down if you had
to and exit if it wasn't big enough. Or open a small window, check 
the borders, close it, set the sizes and reopen it.

>inews fodder inews fodder inews fodder inews fodder inews fodder

Change the include symbol to something like -> (rather than >) and you
don't need this.

--Chuck McManis
uucp: {anywhere}!sun!cmcmanis   BIX: cmcmanis  ARPAnet: cmcmanis@sun.com
These opinions are my own and no one elses, but you knew that didn't you.
"A most excellent barbarian ... Genghis Kahn!"

acs@pccuts.pcc.amdahl.com (Tony Sumrall) (04/29/89)

In article <101870@sun.Eng.Sun.COM> cmcmanis@sun.UUCP (Chuck McManis) writes:
->In article <783@pccuts.pcc.amdahl.com> (Tony Sumrall) writes:
->>  ...  There are times that it would be nice to have this info *before*
->> you open the window (like, so you could set the window's size prior to
->> the OpenWindow() call).
->
->When? I have been thinking about it and can't come up with a time when
->you need this information before you open the window. You could always 
->open the window, check the borders and then resize it down if you had
->to and exit if it wasn't big enough. Or open a small window, check 
->the borders, close it, set the sizes and reopen it.

But the point is that I don't *want* to flash a window at the user -- it
looks tacky. In VT100, since I have the user tell me how many LINES (s)he
wants to see (which is, I think, MUCH more friendly than forcing the user
to calculate pixels), I *assume* a top and bottom border size.  I'd
prefer to not have to guess.

->>inews fodder inews fodder inews fodder inews fodder inews fodder
->
->Change the include symbol to something like -> (rather than >) and you
->don't need this.

Yeah, I'm usually too lazy to do that.  You notice that I took your advice
this time, though :-)

->--Chuck McManis
->uucp: {anywhere}!sun!cmcmanis   BIX: cmcmanis  ARPAnet: cmcmanis@sun.com
->These opinions are my own and no one elses, but you knew that didn't you.
-- 
Tony Sumrall acs@pccuts.pcc.amdahl.com <=> amdahl!pccuts!acs

[ Opinions expressed herein are the author's and should not be construed
  to reflect the views of Amdahl Corp. ]

dillon@HERMES.BERKELEY.EDU (Matt Dillon) (04/30/89)

	I haven't tried this, but one *might* be able to setup a FAKE,
0 bit plane screen and open the window in that to determine the window limits.
If 0 doesn't work, maybe a FAKE 1 bit plane screen ...

				-Matt

dillon@HERMES.BERKELEY.EDU (Matt Dillon) (04/30/89)

	Heh.  Ok, I tried a 0-bitplane screen and crashed my Amiga.  oh well.
The next best thing I suppose is to open a 1-bitplane SCREENBEHIND screen,
then a window in it, figure out the border, and close the window & screen ??

	Or, how about this:  Open a BACKDROP|SIMPLE_REFRESH window with the 
pens set to 0 so very little shows up on the screen, get the borders or 
whatever else, then close the BACKDROP window, then open your normal window.
This method has the advantage of not taking much memory.

	Unfortunately, the gadgets will show up, and I assume you need the
gadgets to properly determine window borders.  Hmm... still, it might be
reasonable.

					-Matt

wolff@cs.purdue.EDU (Robert M. Wolff) (04/30/89)

From article <8904291926.AA19974@hermes.berkeley.edu>, by dillon@HERMES.BERKELEY.EDU (Matt Dillon):
>  [....]
> 	Or, how about this:  Open a BACKDROP|SIMPLE_REFRESH window with the 
> pens set to 0 so very little shows up on the screen, get the borders or 
> whatever else, then close the BACKDROP window, then open your normal window.
> This method has the advantage of not taking much memory.
>  [....]
> 					-Matt

I assume you want dOvo know the maximum width/height of the 'preferences'
screen? Well, in vt100v2.x they do it a nice little way...

The way is to open 'gfxbase' and then there are two pointers in the
GfxBase structure. They are maximums for both width and height. They will
be there for you...I forgot the variable names...been a while...

Just look in the includes and then write a REAL simple program to printf
the GfxBase->(variable) out to stdout and see what they are...that is
how I open a window on workbench in a post-it program I am working on.
 
 bob


-- 
-=-=-=- Insert Standard Disclaimer Here, Please... -=-=-=-

/*************  MS-Dos? Me? No, You must be mistaken! *************/

acs@pccuts.pcc.amdahl.com (Tony Sumrall) (05/02/89)

In article <6678@medusa.cs.purdue.edu> wolff@cs.purdue.EDU (Robert M. Wolff) writes:
>I assume you want dOvo know the maximum width/height of the 'preferences'
>screen? Well, in vt100v2.x they do it a nice little way...
 
"They" is ME.  I do VT100.  What I was talking about was a means of finding
the size of the BORDERS.
  
> bob
-- 
Tony Sumrall acs@pccuts.pcc.amdahl.com <=> amdahl!pccuts!acs

[ Opinions expressed herein are the author's and should not be construed
  to reflect the views of Amdahl Corp. ]

wolff@cs.purdue.EDU (Robert M. Wolff) (05/02/89)

From article <788@pccuts.pcc.amdahl.com>, by acs@pccuts.pcc.amdahl.com (Tony Sumrall):
> In article <6678@medusa.cs.purdue.edu> wolff@cs.purdue.EDU (Robert M. Wolff) writes:
>>I assume you want dOvo know the maximum width/height of the 'preferences'
>>screen? Well, in vt100v2.x they do it a nice little way...
>  
> "They" is ME.  I do VT100.  What I was talking about was a means of finding
> the size of the BORDERS.
>   
>> bob
> -- 
> Tony Sumrall acs@pccuts.pcc.amdahl.com <=> amdahl!pccuts!acs

Oops, sorry...I figured more than one person did the work on VT100...

Well done for a one person job!

What do you mean by finding the size of the BORDERS? What borders are you
talking about here?

It's late, so I could just have mind-fry (finals are NOW too...) but I just
cant seem to figure what borders you speak of...

Thanks,
bob

-- 
-=-=-=- Insert Standard Disclaimer Here, Please... -=-=-=-

/*************  MS-Dos? Me? No, You must be mistaken! *************/

usenet@cps3xx.UUCP (Usenet file owner) (05/02/89)

I am working on a project that involves putting gadgets (props. and
arrows for text scrolling) of the correct size in the borders.

I open my window first, and then look at the border sizes and
plug the numbers into my gadgets, and AddGadget them to the
window.
Seems to work ok. I haven't been working on it lately, and
I don't remember exactly how it appears to the user.

usenet@cps3xx.UUCP (Usenet file owner) (05/02/89)

In article <2797@cps3xx.UUCP> porkka@frith.UUCP (Joseph A Porkka) writes:
>I open my window first, and then look at the border sizes and

Note: I have a size gadget with SIZEBRIGHT | SIZEBBOTTOM set.

wolff@cs.purdue.EDU (Robert M. Wolff) (05/03/89)

From article <2798@cps3xx.UUCP>, by usenet@cps3xx.UUCP (Usenet file owner):
> In article <2797@cps3xx.UUCP> porkka@frith.UUCP (Joseph A Porkka) writes:
>>I open my window first, and then look at the border sizes and
> 

Do you really want this window that you are opening to be FULL size in
any case? I mean, if someone has a viking monitor (1008x800), they
are going to get a BIG window witha couple of gadgets sitting out
in never-never land...

bob
-- 
-=-=-=- Insert Standard Disclaimer Here, Please... -=-=-=-

/*************  MS-Dos? Me? No, You must be mistaken! *************/

usenet@cps3xx.UUCP (Usenet file owner) (05/03/89)

In article <6701@medusa.cs.purdue.edu> wolff@cs.purdue.EDU (Robert M. Wolff) writes:
>From article <2798@cps3xx.UUCP>, by usenet@cps3xx.UUCP (Usenet file owner):
>> In article <2797@cps3xx.UUCP> porkka@frith.UUCP (Joe A Porkka) writes:
>>>I open my window first, and then look at the border sizes and
>> 
>
>Do you really want this window that you are opening to be FULL size in
>any case? I mean, if someone has a viking monitor (1008x800), they
>are going to get a BIG window witha couple of gadgets sitting out
>in never-never land...

What is a viking monitor?(with a gfx card too i would assume)

(Bob, please don't take this as a flame on you. Its not)
I'e just learned somethin' usefull:
	If your'e not sure what the discussion is about, go
	back and read the original post + a few followups!

My needs were a bit different than VT100's. I want a window of whatever
size, and I will make stuff fit into it. VT100 wants the window to fit the
contents. Either way there is no need to open maximum size window.

Unless there are some hidden fields somewhere, and unless you have
another window open (and your'e sure yours will open with the same
font) then I think your best bet is to guess, then call Resize window
if you guessed wrong, and then add your applications gadgets.
Unless the system is loaded, that should not cause much hashing of the
display.

A question: If you don't already have a window open, then you probly
dont need to have a screen open yet, so just open your screen behind,
and bring it to front after the window is just right.

wolff@cs.purdue.EDU (Robert M. Wolff) (05/04/89)

From article <2816@cps3xx.UUCP>, by usenet@cps3xx.UUCP (Usenet file owner):
> What is a viking monitor?(with a gfx card too i would assume)
> 

The viking monitor is a 1008x800 display monitor that (as far as I know)
needs *NO* extra graphics cards. If the software is written properly, then
it will show up properly on the viking.
The viking is only 2 bitplanes though... :-(

> (Bob, please don't take this as a flame on you. Its not)
> 	back and read the original post + a few followups!
> 

Yes, you *ARE* right...I did jump in the middle here...sorry for being
lost...but with using 'vn' (the screen oriented newsreader), I cant
go back to the original (as far as I know)...sorry again... :-|

bob
-- 
-=-=-=- Insert Standard Disclaimer Here, Please... -=-=-=-

/*************  MS-Dos? Me? No, You must be mistaken! *************/

doug@xdos.UUCP (Doug Merritt) (05/04/89)

In article <6693@medusa.cs.purdue.edu> wolff@cs.purdue.EDU (Robert M. Wolff) writes:
>
>Oops, sorry...I figured more than one person did the work on VT100...
>
>Well done for a one person job!
           ^^^^^^^^^^^^^^^^^^^^

Can't resist the nitpick: sounds like damning with faint praise.

How about: "Well done!"

I use it daily; very handy.
	Doug
-- 
Doug Merritt			Member, Crusaders for a Better Tomorrow
{pyramid,apple}!xdos!doug	Professional Wildeyed Visionary

"Of course, I'm no rocket scientist" -- Randell Jesup, Capt. Boinger Corps

papa@pollux.usc.edu (Marco Papa) (05/04/89)

In article <6704@medusa.cs.purdue.edu> wolff@cs.purdue.EDU (Robert M. Wolff) writes:
>From article <2816@cps3xx.UUCP>, by usenet@cps3xx.UUCP (Usenet file owner):
>> What is a viking monitor?(with a gfx card too i would assume)

>The viking monitor is a 1008x800 display monitor that (as far as I know)
>needs *NO* extra graphics cards. If the software is written properly, then
       ^^^^^^^^^^^^^^^^^^^^^^^^^
>it will show up properly on the viking.
>The viking is only 2 bitplanes though... :-(

Wrong! I have one.  It needs a separate video card that goes in the A2x00
video slot (only the first one is used, so it will work even with old "german"
A2000s, unlike the flickerFixer that uses BOTH video slots and therefore
will work only on B2000s).  So the Viking 1 cannot be used with A1000s and 
A500s. The CBM A2024, on the other hand, has the circuitry all inside the
monitor and therefore it will work on ALL Amigas (with some gotchas due to
the memory required on an A1000).  The A2024 is not available, though.

-- Marco Papa 'Doc'
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
uucp:...!pollux!papa       BIX:papa       ARPAnet:pollux!papa@oberon.usc.edu
 "There's Alpha, Beta, Gamma and Diga!" -- Leo Schwab [quoting Rick Unland]
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

wolff@cs.purdue.EDU (Robert M. Wolff) (05/05/89)

From article <16998@usc.edu>, by papa@pollux.usc.edu (Marco Papa):
> 
>>The viking monitor is a 1008x800 display monitor that (as far as I know)
>>needs *NO* extra graphics cards. If the software is written properly, then
>        ^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> Wrong! I have one.  It needs a separate video card that goes in the A2x00
> video slot (only the first one is used, so it will work even with old "german"
> [....more FACTS about viking....]

Oops...sorry I was told it needed no graphics card...makes sense that it
does need one though...

That makes two blunders on my part recently...hmm...I guess I'd better
blame it on finals week and take a vacation...  :-)

Thanks for correcting me...  :-|

> 
> -- Marco Papa 'Doc'

bob

-- 
-=-=-=- Insert Standard Disclaimer Here, Please... -=-=-=-

/*************  MS-Dos? Me? No, You must be mistaken! *************/

acs@pccuts.pcc.amdahl.com (Tony Sumrall) (05/05/89)

In article <259@xdos.UUCP> doug@xdos.UUCP (Doug Merritt) writes:
->In article <6693@medusa.cs.purdue.edu> wolff@cs.purdue.EDU (Robert M. Wolff) writes:
->>
->>Oops, sorry...I figured more than one person did the work on VT100...
->>
->>Well done for a one person job!
             ^^^^^^^^^^^^^^^^^^^^
Actually, it *isn't* a one person job.  Many many people have contributed
(not to mention Dave Wecker who, more or less, started it).  Take a look
at the documentation files for other major contributors.  While we're at
it let's not forget the alpha and beta-testers and all of the people that
have sent in ideas and argued me into providing new features, etc.

->Can't resist the nitpick: sounds like damning with faint praise.
->
->How about: "Well done!"
->
->I use it daily; very handy.

I appreciate the sentiment but it's enough for me to know that at least
one other person uses it.

->Doug Merritt			Member, Crusaders for a Better Tomorrow
->{pyramid,apple}!xdos!doug	Professional Wildeyed Visionary
-- 
Tony Sumrall acs@pccuts.pcc.amdahl.com <=> amdahl!pccuts!acs

[ Opinions expressed herein are the author's and should not be construed
  to reflect the views of Amdahl Corp. ]