[comp.os.os2.programmer] Using VioSetMode

colin@la.excelan.com (Colin Goldstein) (01/10/91)

I have a question about using VioSetMode. I find that it only works
some times. If I have the display in 80*50 mode and use VioSetMode
to change it to 80*25, it works. However, if I'm in other modes such
as 80*34 it does not work at all. And if I'm in 80*12 or 80*43, it
only partially works. Although the screen changes to the correct 
number of lines, the font is not the default font.

I have enclosed the code I'm using to test this. Any help would be
appreciated.

Colin
------------ CODE ------------------ CODE --------------------------
#define INCL_BASE
#define INCL_NOPM
#include <os2.h>

main()
{
   VIOMODEINFO viomi;
   BYTE bCell[2];

   bCell[0] = 0x20;      /* space character       */
   bCell[1] = 0x07;      /* white attribute (EGA) */

//   VioScrollDn(0, 0, 0xFFFF, 0xFFFF, 0xFFFF, bCell, 0);
//   VioSetCurPos(0, 0, 0);

   viomi.cb = sizeof(viomi);
   VioGetMode(&viomi, 0);

   viomi.row = 25;
   viomi.col = 80;
   VioSetMode(&viomi, 0);
}
------------- CODE ----------------------- CODE ----------------------
/-------------------------------------------------------------------\
|  The views expressed here are my own.  | Norm, what are you       |
|  They do not necessarily represent     | up too???                |
|  the views expressed by my employer.   |                          |
|                         ---------------| My ideal weight if I     |
|  colin@novell.com       | Novell Inc., | were 11 feet tall.       |
|  uunet!novell!colin     | San Jose     |                 - Cheers |
\-------------------------------------------------------------------/

cfreas@eeserv1.ic.sunysb.edu (Terry Freas) (01/11/91)

In article <2593@excelan.COM> colin@la.excelan.com (Colin Goldstein) writes:
>I have a question about using VioSetMode. I find that it only works
>some times. If I have the display in 80*50 mode and use VioSetMode
>to change it to 80*25, it works. However, if I'm in other modes such
>as 80*34 it does not work at all. And if I'm in 80*12 or 80*43, it
>only partially works. Although the screen changes to the correct 
>number of lines, the font is not the default font.
>
>I have enclosed the code I'm using to test this. Any help would be
>appreciated.
>
> [enclosed code deleted]

I have also noticed that I can set a text session to 80*60 using
'mode 80,60'.  However, the highest VioSetMode will achieve is
80*50.  Errors occur exceeding it.  Strange...
-- 
Jeremy Wohl / wohl@max.physics.sunysb.edu / cfreas@csserv1.ic.sunysb.edu

rommel@lan.informatik.tu-muenchen.dbp.de (Kai-Uwe Rommel) (01/15/91)

In article <2593@excelan.COM> colin@la.excelan.com (Colin Goldstein) writes:
>I have a question about using VioSetMode. I find that it only works
>some times. If I have the display in 80*50 mode and use VioSetMode
>to change it to 80*25, it works. However, if I'm in other modes such
>as 80*34 it does not work at all. And if I'm in 80*12 or 80*43, it
>only partially works. Although the screen changes to the correct 
>number of lines, the font is not the default font.

>   viomi.cb = sizeof(viomi);
>   VioGetMode(&viomi, 0);
>
>   viomi.row = 25;
>   viomi.col = 80;
>   VioSetMode(&viomi, 0);

Try setting the hres and vres fields (screen pixel width/height) to to
appropriate values. For example, while 80x25 and 80x50 both work with
720x400, 80x34 works with 720x480! This should solve your problem.
Always calculate hres and vres from row/col and the font size (9x16,
9x14 and 9x8); hres is always 720 on VGA, vres has to be set by you.

Kai Uwe Rommel

--
/* Kai Uwe Rommel, Munich ----- rommel@lan.informatik.tu-muenchen.dbp.de */

DOS ... is still a real mode only non-reentrant interrupt
handler, and always will be.                -Russell Williams (MS)