home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c005 / 5.ddi / C / WNCURMOV.C < prev    next >
Encoding:
C/C++ Source or Header  |  1987-04-13  |  1.7 KB  |  67 lines

  1. /**
  2. *
  3. * Name        wncurmov -- Move the current window's cursor.
  4. *
  5. * Synopsis    presult = wncurmov(row,column);
  6. *
  7. *        BWINDOW *presult  Pointer to current window structure,
  8. *                  or NIL if failure.
  9. *        int row,column      Row and column (relative to upper left
  10. *                  corner of window) of new cursor
  11. *                  position.
  12. *
  13. * Description    The current window's cursor is moved.  No change is
  14. *        visible unless the window has been selected via WNCURSOR
  15. *        to have the active cursor on its display page.
  16. *
  17. *        An error occurs if the position is beyond the bounds of
  18. *        the window.
  19. *
  20. * Returns    presult       Pointer to current BWINDOW
  21. *                  structure, or NIL if failure.
  22. *        b_pcurwin->cur_loc Current BWINDOW cursor position,
  23. *                  or unchanged if failure.
  24. *        b_wnerr       Possible values:
  25. *                  (No change)       Success.
  26. *                  WN_ILL_DIM       Position out of range.
  27. *                  WN_BAD_WIN       No window designated
  28. *                           as current.
  29. *
  30. * Version    3.0  (C)Copyright Blaise Computing Inc. 1986
  31. *
  32. * Version    3.02 March 20, 1987
  33. *        Prevented physical cursor movement if window is delayed.
  34. *
  35. **/
  36.  
  37. #include <bwindow.h>
  38.  
  39. BWINDOW *wncurmov(row,column)
  40. int row,column;
  41. {
  42.     if (wnvalwin(b_pcurwin) == NIL)
  43.     {
  44.     wnerror(WN_BAD_WIN);
  45.     return NIL;
  46.     }
  47.     if (   row      <  0
  48.     || row      >= b_pcurwin->img.dim.h
  49.     || column <  0
  50.     || column >= b_pcurwin->img.dim.w)
  51.     {
  52.     wnerror(WN_ILL_DIM);
  53.     return NIL;
  54.     }
  55.  
  56.     b_pcurwin->cur_loc.row = row;
  57.     b_pcurwin->cur_loc.col = column;
  58.  
  59.     if (b_pcurwin->where_shown.dev != ABSENT
  60.     && (!b_pcurwin->internals.cur_frozen)
  61.     && (!b_pcurwin->options.delayed))
  62.         sccurset(b_pcurwin->where_shown.corner.row + row,
  63.              b_pcurwin->where_shown.corner.col + column);
  64.  
  65.     return b_pcurwin;
  66. }
  67.