(final patch from <Someone>)

This patch implements two things:
- space now dismisses a menu, text or menutext window when you are
  at the bottom of that window
- Page scrolling in menus now works as follows:
  pressing PgDn (or Space in NH mode) moves the focus down one page,
  and moves the scroll position down one page. The effect of this
  is that you always get a full new page of items (which is what
  NetHack players expect), and that the focus moved down one page
  (what Windows users expect.)
  The same (revers) goes for scrolling up a page.

A Windows user will still be a bit surprised when the focus is on
the top item, and he presses '>': he gets a new page of things instead
of the focus moving to the bottom of the page.
However, the PgUp/PgDn keys (which he probably uses) still have the
old Windows behaviour.
This commit is contained in:
nethack.allison
2002-03-20 13:05:58 +00:00
parent 45682588a1
commit f72ed65d1a
2 changed files with 53 additions and 7 deletions
+10 -1
View File
@@ -216,11 +216,20 @@ LRESULT CALLBACK NHEditHookWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARA
/* close on space in Windows mode
page down on space in NetHack mode */
case VK_SPACE:
if (GetNHApp()->regNetHackMode)
{
SCROLLINFO si;
si.cbSize = sizeof(SCROLLINFO);
si.fMask = SIF_POS | SIF_RANGE | SIF_PAGE;
GetScrollInfo(hWnd, SB_VERT, &si);
/* If nethackmode and not at the end of the list */
if (GetNHApp()->regNetHackMode &&
(si.nPos + (int)si.nPage) <= (si.nMax - si.nMin))
SendMessage(hWnd, EM_SCROLL, SB_PAGEDOWN, 0);
else
PostMessage(GetParent(hWnd), WM_COMMAND, MAKELONG(IDOK, 0), 0);
return 0;
}
case VK_NEXT:
SendMessage(hWnd, EM_SCROLL, SB_PAGEDOWN, 0);
return 0;