Print Page | Close Window

CXTPSyntaxEditCtrl::CanEditDoc() bug?

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=16604
Printed Date: 28 September 2024 at 7:35pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTPSyntaxEditCtrl::CanEditDoc() bug?
Posted By: awelzel
Subject: CXTPSyntaxEditCtrl::CanEditDoc() bug?
Date 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.




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net