[comp.sys.amiga.programmer] Console device's "Window Bounds Report" buggy?

bruceg@crash.cts.com (Bruce Geerdes) (06/26/91)

I am writing an all-text program, using the console device.  Whenever the
user resizes the window, I want to reformat the text.  So whenever I get a 
NEWSIZE message I send a "window status request" (page 645 RKM Libraries & 
Devices 1.3) to get the current row and column capacity of the window, but it 
always returns the stats of the window's original size, not its current.  Has 
anyone here gotten it to work?  

darren@cbmvax.commodore.com (Darren Greenwald) (06/27/91)

In article <1991Jun26.025314.9658@crash.cts.com> bruceg@crash.cts.com (Bruce Geerdes) writes:
>I am writing an all-text program, using the console device.  Whenever the
>user resizes the window, I want to reformat the text.  So whenever I get a 
>NEWSIZE message I send a "window status request" (page 645 RKM Libraries & 
>Devices 1.3) to get the current row and column capacity of the window, but it 
>always returns the stats of the window's original size, not its current.  Has 
>anyone here gotten it to work?  

Hmm, I just tried this under 2.0 console.device works fine.  Are
you accounting for the fact that the length of the returned string
is variable (e.g., a window with a capacity of 9x9 returns a
shorter string than a window which is 40x40)?


--------------------------------------------------------------
Darren M. Greenwald | Commodore-Amiga Software Engineering   
                    | USENET: uunet!cbmvax!darren                       
--------------------------------------------------------------
Quote: "It would be impossible to discuss the subject without
        a common frame of reference." - Spock

carolyn@cbmvax.commodore.com (Carolyn Scheppner - CATS) (06/28/91)

In article <1991Jun26.025314.9658@crash.cts.com> bruceg@crash.cts.com (Bruce Geerdes) writes:
>I am writing an all-text program, using the console device.  Whenever the
>user resizes the window, I want to reformat the text.  So whenever I get a 
>NEWSIZE message I send a "window status request" (page 645 RKM Libraries & 
>Devices 1.3) to get the current row and column capacity of the window, but it 
>always returns the stats of the window's original size, not its current.  Has 
>anyone here gotten it to work?  

I use the ConUnit instead.  In your console device IORequest structure,
after you do OpenDevice, there will be an io_Unit pointer which is
a pointer to a struct ConUnit.  WARNING - ConUnit structure is
READ ONLY.  Some REAL handy things to read out of the ConUnit structure
are:

cu_XMax and cu_YMax	- the max X/Y character (not pixel) positions
			  (ie. like 80 x 25)
cu_XCP and cu_YCP	- the current cursor X/Y charactor position

-- 
==========================================================================
 Carolyn Scheppner -- Tech. Mgr. CATS - Commodore Amiga Technical Support
 PHONE 215-431-9180 {uunet,rutgers}!cbmvax!carolyn  carolyn@commodore.com

 Pad with zeros for a light, airy program.
==========================================================================

bruceg@crash.cts.com (Bruce Geerdes) (06/29/91)

In article <22733@cbmvax.commodore.com> darren@cbmvax.commodore.com (Darren Greenwald) writes:
>In article <1991Jun26.025314.9658@crash.cts.com> bruceg@crash.cts.com (Bruce Geerdes) writes:
>>I am writing an all-text program, using the console device.  Whenever the
>>user resizes the window, I want to reformat the text.  So whenever I get a 
>>NEWSIZE message I send a "window status request" (page 645 RKM Libraries & 
>>Devices 1.3) to get the current row and column capacity of the window, but it 
>>always returns the stats of the window's original size, not its current.  Has 
>>anyone here gotten it to work?  
>
>Hmm, I just tried this under 2.0 console.device works fine.  Are
>you accounting for the fact that the length of the returned string
>is variable (e.g., a window with a capacity of 9x9 returns a
>shorter string than a window which is 40x40)?

I figured out what the problem was.  It seems that the console device wants
me to send it a SET PAGE LENGTH (0x9B 0x74) and a SET LINE LENGTH (9B 75)
every time I want it to recalculate the bounds of the window.  Not sending
the console these causes it to retain the values of the window when it
was originally opened.  It may just be me, but the 1.3 RKM didn't make it
clear that these commands *had* to be sent every time I wanted info on the
window.  But it's working. :)

bojsen@moria.UUCP (Per Bojsen) (06/29/91)

In article <22746@cbmvax.commodore.com>, Carolyn Scheppner - CATS writes:

> In article <1991Jun26.025314.9658@crash.cts.com> bruceg@crash.cts.com
> (Bruce Geerdes) writes:
>
> > So whenever I get a
> > NEWSIZE message I send a "window status request" (page 645 RKM Libraries &
> > Devices 1.3) to get the current row and column capacity of the window, but
> > it always returns the stats of the window's original size, not its current.
> > Has anyone here gotten it to work?
>
> I use the ConUnit instead.  In your console device IORequest structure,
> after you do OpenDevice, there will be an io_Unit pointer which is
> a pointer to a struct ConUnit.  WARNING - ConUnit structure is
> READ ONLY.  Some REAL handy things to read out of the ConUnit structure
> are:
>
> cu_XMax and cu_YMax   - the max X/Y character (not pixel) positions
>                         (ie. like 80 x 25)
> cu_XCP and cu_YCP     - the current cursor X/Y charactor position
>
On the other hand, if you're using the console.device to do a simple terminal
program for use as a terminal to a remote Amiga (using the Aux-Handler), you're
stuck with the window status request escape sequences, since the Aux-Handler
does not emulate the ConUnit structure.

For example, one version of Stevie used the ConUnit structure to get the
window size, but when run via the Aux-Handler over a serial line this does
not work.  I had to hack Stevie to use the window status request since that
would make the local console.device unit (being the terminal program window)
respond with *its* window size.  This works fine under 2.0.

--
.------------------------------------------------------------------------------.
|  Greetings from Per Bojsen.                                                  |
+------------------------------+-----------------------------------------------+
|  EMail: cbmehq!lenler!bojsen | "Names do have power, after all, that of      |
|     Or: bojsen@dc.dth.dk     |  conjuring images of places we have not seen" |
`------------------------------+-----------------------------------------------'