2008-04-24 10:51 UTC+0100 Viktor Szakats (harbour.01 syenar hu)
* include/memoedit.ch
* source/rtl/memoedit.prg
! XPP feature marked with HB_COMPAT_XPP.
! Fixed to not crash if user callback function
returns non-numeric type.
This commit is contained in:
@@ -8,6 +8,13 @@
|
||||
2008-12-31 13:59 UTC+0100 Foo Bar <foo.bar@foobar.org>
|
||||
*/
|
||||
|
||||
2008-04-24 10:51 UTC+0100 Viktor Szakats (harbour.01 syenar hu)
|
||||
* include/memoedit.ch
|
||||
* source/rtl/memoedit.prg
|
||||
! XPP feature marked with HB_COMPAT_XPP.
|
||||
! Fixed to not crash if user callback function
|
||||
returns non-numeric type.
|
||||
|
||||
2008-04-24 10:24 UTC+0100 Viktor Szakats (harbour.01 syenar hu)
|
||||
* contrib/xhb/xhb.ch
|
||||
* contrib/xhb/xhbfunc.c
|
||||
|
||||
@@ -58,9 +58,11 @@
|
||||
#define ME_UNKEY 1 /* Unknown key, memo unaltered */
|
||||
#define ME_UNKEYX 2 /* Unknown key, memo altered */
|
||||
#define ME_INIT 3 /* Initialization mode */
|
||||
#ifdef HB_COMPAT_XPP
|
||||
#define ME_REQUEST 4 /* Memoedit requests an input from */
|
||||
/* the user function, e.g. after */
|
||||
/* ME_PASTE */ /* Xbase++ extension */
|
||||
#endif
|
||||
|
||||
/* User callback return codes */
|
||||
#define ME_DEFAULT 0 /* Perform default action */
|
||||
@@ -70,7 +72,9 @@
|
||||
#define ME_TOGGLESCROLL 35 /* Toggle scrolling mode */
|
||||
#define ME_WORDRIGHT 100 /* Perform word-right operation */
|
||||
#define ME_BOTTOMRIGHT 101 /* Perform bottom-right operation */
|
||||
#ifdef HB_COMPAT_XPP
|
||||
#define ME_PASTE 110 /* Paste string into buffer */ /* Xbase++ extension */
|
||||
#endif
|
||||
|
||||
/* NOTE: Return codes 1-31 cause MEMOEDIT() to perform the */
|
||||
/* edit action corresponding to the key whose value is returned. */
|
||||
|
||||
@@ -81,7 +81,7 @@ METHOD MemoInit( xUserFunction ) CLASS HBMemoEditor
|
||||
::xUserFunction := xUserFunction
|
||||
|
||||
IF ISCHARACTER( ::xUserFunction )
|
||||
// Keep calling user function until it returns 0
|
||||
// Keep calling user function until it returns ME_DEFAULT
|
||||
DO WHILE ( nKey := ::xDo( ME_INIT ) ) != ME_DEFAULT
|
||||
|
||||
// At this time there is no input from user of MemoEdit() only handling
|
||||
@@ -223,6 +223,11 @@ METHOD HandleUserKey( nKey, nUserKey ) CLASS HBMemoEditor
|
||||
CASE nUserKey == ME_BOTTOMRIGHT
|
||||
::MoveCursor( K_CTRL_END )
|
||||
|
||||
#ifdef HB_COMPAT_XPP
|
||||
CASE nUserKey == ME_PASTE
|
||||
// TODO
|
||||
#endif
|
||||
|
||||
OTHERWISE
|
||||
// Do nothing
|
||||
ENDCASE
|
||||
@@ -237,6 +242,10 @@ METHOD xDo( nStatus ) CLASS HBMemoEditor
|
||||
|
||||
LOCAL xResult := Do( ::xUserFunction, nStatus, ::nRow, ::nCol - 1 )
|
||||
|
||||
IF ! ISNUMBER( xResult )
|
||||
xResult := ME_DEFAULT
|
||||
ENDIF
|
||||
|
||||
::SetPos( nOldRow, nOldCol )
|
||||
SetCursor( nOldCur )
|
||||
|
||||
|
||||
Reference in New Issue
Block a user