Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - CXTPSyntaxEditCtrl::CanEditDoc() bug?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTPSyntaxEditCtrl::CanEditDoc() bug?

 Post Reply Post Reply
Author
Message
awelzel View Drop Down
Newbie
Newbie
Avatar

Joined: 16 April 2010
Location: Germany
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote awelzel Quote  Post ReplyReply Direct Link To This Post Topic: CXTPSyntaxEditCtrl::CanEditDoc() bug?
    Posted: 16 April 2010 at 6:37am
To disable editing in CXTPSyntaxEditCtrl there seem to be three methods:

  1. CXTPSyntaxEditCtrl::SetViewOnly(TRUE) - text is still displayed as usual, but no editing possible and there is even no cursor
  2. CXTPSyntaxEditCtrl::SetReadOnly(TRUE) - same as SetViewOnly(), but text is also greyed
  3. Overwriting CXTPSyntaxEditCtrl::CanEditDoc() to return FALSE always - so text is not editable, but you can still mark text using the cursor etc.
We use a class based on CXTPSyntaxEditCtrl to implement a log output window with syntax highlighting. The user must not be able to change anything in this output window, but he should be able to mark and copy parts of the output.

So we've overwritten CXTPSyntaxEditCtrl::CanEditDoc():

BOOL CMyClass::CanEditDoc()
{
    return FALSE;
}

Result: There is still a cursor and text can still be selected and copied but it can not be changed.

BUT: When selecting text, this text block can be moved around using the left mouse button - which is of course a change of the text!

Shouldn't CanEditDoc() avoid this behaviour as well? Using SetViewOnly() or SetReadOnly() is not an options, as this also disables the cursor, which is needed to select text.

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.203 seconds.