Suggestions for changes to the TRichEdit5 class

Suggestions for changes to the TRichEdit5 class

Postby MaxP » Fri Nov 22, 2019 9:15 am

Hi Antonio,

I suggest these changes to the TRichEdit5 class

1) bug on resize image in InsertBitmap

Code: Select all  Expand view
METHOD InsertBitmap( hBitmap, nSizeX, nSizeY, lSpecial ) CLASS TRichEdit5

   local oClp
   DEFAULT lSpecial := .F.
   #ifndef _WIN64
/*****
      ::InsertPicture5( hBitmap ) */

      ::InsertPicture5( hBitmap, nSizeX, nSizeY )
   #else
      if !Empty( hBitMap )
         oClp := TClipBoard():New( CF_BITMAP, ::oWnd )
         oClp:SetBitmap( hBitmap )
         if lSpecial
            ::PasteSpecial()
         else
            ::Paste()
         endif
      endif
   #endif

Return nil


2) to improve typing speed after entering an image

2a) add a new method LostFocus
Code: Select all  Expand view
CLASS TRichEdit5 FROM TControl

...
...

/*****/
   METHOD LostFocus( hWndGetFocus ) INLINE ::PostMsg( FM_CHANGE ), ::Super:LostFocus( hWndGetFocus )
ENDCLASS

2b) exclude the FM_CHANGE message in METHOD KeyChar
Code: Select all  Expand view
METHOD KeyChar( nKey, nFlags ) CLASS TRichEdit5

   if ::lReadOnly .and. ! GetKeyState( VK_ESCAPE )
      return 0
   endif

   ::Super:KeyChar( nKey, nFlags )
/*****
   ::PostMsg( FM_CHANGE ) */


   if ::lHighlight
      ::PostMsg( FM_HIGHLIGHT )
   endif

return nil

2c) exclude the FM_CHANGE message in METHOD KeyDown
Code: Select all  Expand view
METHOD KeyDown( nKey, nFlags ) CLASS TRichEdit5

   if ( nKey == VK_INSERT  .and. GetKeyState( VK_SHIFT ) .or. ;
        nKey == Asc( "V" ) .and. GetKeyState( VK_CONTROL ) )

      if ! ::lReadOnly
         ::Paste()
         ::PostMsg( FM_CHANGE )
      endif

      return 0
   endif

   if ::lReadOnly
      if nKey == VK_BACK .or. nKey == VK_DELETE .or. nKey == VK_RETURN
         return 0
      endif
   endif

   ::Super:KeyDown( nKey, nFlags )
/*****
   ::PostMsg( FM_CHANGE ) */


   if ::lHighlight
      if nKey == VK_DELETE .or. nKey == VK_BACK
         ::PostMsg( FM_HIGHLIGHT )
      endif
   endif

return nil


Regards
Massimo
User avatar
MaxP
 
Posts: 84
Joined: Thu Jul 12, 2007 2:02 pm

Re: Suggestions for changes to the TRichEdit5 class

Postby cnavarro » Wed Nov 27, 2019 6:24 pm

Thanks Massimo
Included in the next version 19.10
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6504
Joined: Wed Feb 15, 2012 8:25 pm
Location: España


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 12 guests