DataWindow

문제

키보드를 사용하여 페이지이동 및 행이동

해결

먼저 userevent를 만듭니다.
user event의 이름은 keydown, argument는 pbm_dwnkey로 합니다.

그리고 다음의 스크립트를 dw의 keydown에 넣습니다.

아래의 소스는 함수와부 event script로 나누어져 있던건데 강제로 붙여 놓아서
보기는 별로 안 좋은데 정확히 동작은 합니다.

//------------------------------------------------------------------------------
integer    KeyID
long        rc, rn, fr, lr, sz, sp

// 작업거부
if row        = 0  then return
if rowcount() = 0  then return
if key = KeyEnter! then return

// KeyID
Choose case key
   case KeyUpArrow!  ;KeyID=01
   case KeyDownArrow!;KeyID=02
   case KeyPageUp!   ;KeyID=03
   case KeyPageDown! ;KeyID=04
   case KeyHome!     ;KeyID=05
   case KeyEnd!      ;KeyID=06
   case KeyInsert!   ;KeyID=07
   case KeyDelete!   ;KeyID=08
   case KeyEscape!   ;KeyID=09
end Choose

// 변수 초기화
rc = RowCount()
rn = GetSelectedRow(0)
fr = Long(Describe("DataWindow.FirstRowOnPage"))
lr = Long(Describe("DataWindow.LastRowOnPage" ))
sz = lr - fr

Choose case KeyID
   case 1
       if rn >  1 then sp = rn - 1 else sp = rn
   case 2
       if rc > rn then sp = rn + 1 else sp = rn
   case 3
       if fr > rn then rn = fr
       sp = fr - sz - 1
       if sp < 1  then sp = 1
   case 4
       if rn < lr then rn = lr
       sp = rn + sz + 1
       if sp > rc then sp = rc
   case 5
       sp = 1
       ScrollToRow(sp)
   case 6
       sp = rc
       ScrollToRow(sp)
   case 8
       DeleteRow(row)
end Choose

SelectRow(0, False)
SelectRow(sp, True)

참조