diff --git a/ChangeLog.txt b/ChangeLog.txt index 7169ee43b9..9807a3584f 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -39,6 +39,13 @@ ! enable socket type translation for Linux/MIPS, enum order is different there - fixes TCP/IP socket binding on such platform +2015-10-14 00:24 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com) + * src/rtl/achoice.prg + + tests/achoice5.prg + ! AChoice(): fix visual glitch and/or RTE in certain conditions + Patch and sample by Alexey Myronenko + Ref: https://groups.google.com/d/topic/harbour-devel/G9j6WXFFwW4/discussion + 2015-10-13 23:05 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * include/hbwince.h * src/common/hbwince.c diff --git a/src/rtl/achoice.prg b/src/rtl/achoice.prg index 671494caee..24582bb3fa 100644 --- a/src/rtl/achoice.prg +++ b/src/rtl/achoice.prg @@ -281,7 +281,7 @@ FUNCTION AChoice( nTop, nLeft, nBottom, nRight, acItems, xSelect, xUserFunc, nPo CASE nKey == K_CTRL_PGDN .OR. ( nKey == K_END .AND. ! lUserFunc ) IF nPos == nLastItem - IF nAtTop == Min( nLastItem, nItems - nNumRows + 1 ) + IF nAtTop == Min( nLastItem, nItems - Min( nItems, nNumRows ) + 1 ) nMode := AC_HITBOTTOM ELSE nAtTop := Min( nLastItem, nItems - nNumRows + 1 ) @@ -323,7 +323,7 @@ FUNCTION AChoice( nTop, nLeft, nBottom, nRight, acItems, xSelect, xUserFunc, nPo CASE nKey == K_CTRL_END IF nPos == nLastItem - IF nAtTop == Min( nPos, nItems - nNumRows + 1 ) .OR. nPos == nItems + IF nAtTop == Min( nPos, nItems - Min( nItems, nNumRows ) + 1 ) .OR. nPos == nItems nMode := AC_HITBOTTOM ELSE nAtTop := Min( nPos, nItems - nNumRows + 1 ) diff --git a/tests/achoice5.prg b/tests/achoice5.prg new file mode 100644 index 0000000000..7cf76535ef --- /dev/null +++ b/tests/achoice5.prg @@ -0,0 +1,17 @@ +#include "inkey.ch" + +PROCEDURE Main() + + LOCAL nb + + // hb_keyPut( { K_END, K_END, K_UP, K_HOME } ) // Visual glitch + // hb_keyPut( { K_CTRL_END, K_CTRL_END, K_CTRL_HOME } ) // RTE + + CLS + nb := 20 + DispBox( 4, 9, nb + 1, 51,, "W+/B,N/BG" ) + AChoice( 5, 10, nb, 50, ; + { "menu 1", "menu 2", "menu 3", "menu 4", "menu 5", "menu 6", "menu 7", "menu 8", "menu 9", "menu 10" }, ; + { .T., .T., .T., .T., .F., .F., .F., .T., .F., .F. } ) + + RETURN