TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Jay Collins
from: Phil Crown
date: 1995-01-18 14:12:32
subject: Os/2 VIO BOX using High ascii

JC> Can anyone show my an example of how to make a popup type box using
 JC> High ascii and the OS/2 VIO. I don't know the VIO well enough to get
 JC> this to work right. I have an example in an OLD os/2 book, but I get
 JC> pointer errors and such. Reply here or netmail a reply to me at
 JC> 1:275/158. thanks.

Here's how I am doing it, the code that "fills" in the box is kinda slow,
especially on large boxes.  This is a textmode program, so the VioHandle is
hardcoded to 0.

// --------------------------------------------------------------------

VOID  box( SHORT LfRow, SHORT LfColumn, SHORT RtRow, SHORT RtColumn,
           SHORT Style, PBYTE Fill, PBYTE Box_Color )
{
  SHORT   c, i;

  PCHAR   hbar[2]         =  { "D", "M" };
  PCHAR   vbar[2]         =  { "3", ":" };

  PCHAR   LfTopCorner[2]  =  { "Z", "I" };
  PCHAR   RtTopCorner[2]  =  { "?", ";" };

  PCHAR   LfBotCorner[2]  =  { "{at}", "H" };
  PCHAR   RtBotCorner[2]  =  { "Y", "<" };

  for( i = LfColumn; i < RtColumn; i++ ) {
    vputchr( (PCH) hbar[Style], LfRow, i, Box_Color );
    vputchr( (PCH) hbar[Style], RtRow, i, Box_Color );
  }

  for( i = LfRow; i < RtRow; i++ ) {
    vputchr( (PCH) vbar[Style], i, LfColumn, Box_Color );
    vputchr( (PCH) vbar[Style], i, RtColumn, Box_Color );
  }

  vputchr( (PCH) LfTopCorner[Style], LfRow, LfColumn, Box_Color );
  vputchr( (PCH) LfBotCorner[Style], RtRow, LfColumn, Box_Color );
  vputchr( (PCH) RtTopCorner[Style], LfRow, RtColumn, Box_Color );
  vputchr( (PCH) RtBotCorner[Style], RtRow, RtColumn, Box_Color );

  for( c = LfRow + 1; c < RtRow; c++ ) {
    for( i = LfColumn + 1; i < RtColumn; i++ )
      vputchr( (PCH) Fill, c, i, Box_Color );
  }
}

// --------------------------------------------------------------------

VOID  vputchr( PCH Char, USHORT Row, USHORT Column, PBYTE Color )
{
  VioWrtNChar( Char , 1, Row, Column, 0 );
  VioWrtNAttr( Color, 1, Row, Column, 0 );
}


--- Blue Wave/Max v2.20k OS2 Beta
* Origin: Crown Point (1:124/6108.2)
SEEN-BY: 12/2442 620/243 624/50 632/348 640/820 690/660 711/409 410 413 430
SEEN-BY: 711/807 808 809 934 942 949 712/353 515 713/888 800/1 7877/2809
@PATH: 124/6108 1014 1 396/1 3615/50 229/2 12/2442 711/409 808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.