Using window-procedure with >25 lines 
Author Message
 Using window-procedure with >25 lines


Quote:


>>I'm writing a text-based Program, and I used the window procedure lots of
>>times
>>I needed some more space so increased the number of rows to 30 instead of
>>25.

>>But the window-proc can't be used with more than 25 lines.

>The window procedure checks the upper limits against the
>CurCrtSize, which is a word variable w/ low byte X and high
>byte Y. If you update this variable after you initialize the
>screen, then the window procedure could handle non-standard
>screen sizes.  Since the window procedure updates WindMin and
>WindMax, then you could also use the existing Gotoxy, and
>WhereX, and WhereY procedures and functions.

>If I knew which version of TP you were using I could tell you
>the address of "CurCrtSize" relative to some public CRT
>variable.  

Why play such dirty tricks when you can use following:

Procedure Window(x1,y1,x2,y2:word);
Begin
  if y2>rows then y2:=rows;
  if x2>cols then x2:=cols;
  if x1<1 then x1:=1;
  if y1<1 then y1:=1;
  if (y2<y2) or (x2<x1) then exit;
  windmax:=(y2-1)*256+(x2-1);
  windmin:=(y1-1)*256+(x1-1);
  gotoxy(1,1);
End;

Where cols and rows are defined as:

var cols:byte absolute $40:$4a;
    ScreenRows:byte absolute $40:$84;

Function Rows:byte;
begin
 if screenrows>0 then rows:=screenrows+1
                 else rows:=25;
End;

Rows might fail on some old PC's with no EGA+. It might be better to
check also that one has at least EGA and assume 25 otherwise. I
personally do that but I am not enclosing the asm procedures to keep
this simple. But if you have already established that the card is
capable of 80x30 then that's no problem.

If you wanted to play dirty you could just use  inc(windmax,5*256) to
get 5 more rows.

Quote:
>OTOH, you could use font8x8 to get 43 line EGA or 50 line VGA.

If one wanted to watch the 8x8 font one could as well use CGA.

Osmo



Wed, 18 Jun 1902 08:00:00 GMT  
 Using window-procedure with >25 lines

On 7 Aug 1997 14:32:15 GMT, "Floris Looyesteyn"

Quote:

>HELP!!! Is there someone who has a window-replacement or something like
>that?

Poorly misled folk.  Window is a procedure to limit the drawing on a
screen so it will not be full screen.  It is not to increase the
number of lines.

Try TextMode, and I think it'll work out better for what you desire,
though you can not directly determine the number of lines.



Wed, 18 Jun 1902 08:00:00 GMT  
 Using window-procedure with >25 lines

Quote:

>Why play such dirty tricks when you can use following:
>Procedure Window(x1,y1,x2,y2:word);
>Begin

[snip...]

Considering the amount of code you wrote and the fact that you
must insure the replacement Window procedure is declared after
the CRT unit in order to be accessible to other units, I'd
choose to use a pointer to a 0-based array of word, and patch
CurCrtSize using something like:

or, if using TP 4.0 I'd use

I imagine placing the above in the routine that changed the
display to 30 lines with an appropriate comment would suffice.

I do agree that there should at least be enough error checking
to ensure the screen was indeed initialized to 30 lines.

Quote:
>If you wanted to play dirty you could just use  inc(windmax,5*256) to
>get 5 more rows.

This would have to be done each time you wanted to create a
window that extended past the 25th line.  And if the origin of
the window was also beyond the 25th line you would have to
modify WindMin as well.  Considering the gyrations you would
have to go through in order to insure the Window parameters
were valid if the window position and size was determined at
runtime, you may as well abandon the window procedure entirely
and change WindMin and WindMax direct. :->

    ...red

--
Support the anti-Spam amendment
  Join at http://www.cauce.org/



Wed, 18 Jun 1902 08:00:00 GMT  
 Using window-procedure with >25 lines


Quote:


>>Why play such dirty tricks when you can use following:

>>Procedure Window(x1,y1,x2,y2:word);
>>Begin

>[snip...]

>Considering the amount of code you wrote and the fact that you
>must insure the replacement Window procedure is declared after
>the CRT unit in order to be accessible to other units, I'd
>choose to use a pointer to a 0-based array of word, and patch
>CurCrtSize using something like:

>or, if using TP 4.0 I'd use


I on the other hand consider messing with undocumented features
dangerous.

Note that in my code much of it was for error checking. If one trusts the
user in parameters one can just write:

Procedure Window(x1,y1,x2,y2:word);
Begin
  windmax:=(y2-1)*256+(x2-1);
  windmin:=(y1-1)*256+(x1-1);
  gotoxy(1,1);
End;

Quote:

>I imagine placing the above in the routine that changed the
>display to 30 lines with an appropriate comment would suffice.

>I do agree that there should at least be enough error checking
>to ensure the screen was indeed initialized to 30 lines.

>>If you wanted to play dirty you could just use  inc(windmax,5*256) to
>>get 5 more rows.

>This would have to be done each time you wanted to create a
>window that extended past the 25th line.

True but that would probably not be many times.

Quote:
> And if the origin of
>the window was also beyond the 25th line you would have to
>modify WindMin as well.

Would that be very likely case?

Quote:
>Considering the gyrations you would
>have to go through in order to insure the Window parameters
>were valid if the window position and size was determined at
>runtime, you may as well abandon the window procedure entirely
>and change WindMin and WindMax direct. :->

Why? Window() is the interface for doing that.

Quote:
>    ...red

>--
>Support the anti-Spam amendment
>  Join at http://www.cauce.org/

Osmo


Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Using window-procedure with >25 lines

2. Returning to 25 line mode

3. Print Screen 25/50 Lines

4. HELP: Print Screen 25/50 Lines

5. Using Delphi 2.0 data-aware components with Sybase SQL Server 10.0.25

6. HELP>>HELP>>Using an Index for an MSSQL database

7. re : main-->procedure coomunication + Menu Procedure

8. Runtime Error 25

9. FS: Borland Paradox 7.0 @ 25 ukp ono

10. clpb Mini-FAQ V1.25 - Essential Reading for New Subscribers

11. need code to transmit the screen (80*25) to com1

12. Write on position 80,25

 

 
Powered by phpBB® Forum Software