Print Page | Close Window

CXTPReportRecordItem::GetTooltip() and const

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=15740
Printed Date: 15 May 2024 at 2:08am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTPReportRecordItem::GetTooltip() and const
Posted By: zitz
Subject: CXTPReportRecordItem::GetTooltip() and const
Date Posted: 28 November 2009 at 9:29am
For what added const? (everywhere where it is called, it is not const)
I overload CXTPReportRecordItem::GetTooltip() and I can not call from it GetCaption for example



-------------
Xtreme ToolkitPro v13.1.0, static, VC++6



Replies:
Posted By: mdoubson
Date Posted: 28 November 2009 at 11:07pm
Why "added" -
ver 12.1:

//-----------------------------------------------------------------------

// Summary:

// Returns the text tool tip for the item

// Returns:

// The text tool tip for the item.

//-----------------------------------------------------------------------

virtual CString GetTooltip() const;

//-----------------------------------------------------------------------

// Summary:

// Call this member to set/change the item tool tip.

// Parameters:

// lpszTooltip - Tool tip of the item

//-----------------------------------------------------------------------

virtual void SetTooltip(LPCTSTR lpszTooltip);



-------------
Mark Doubson, Ph.D.


Posted By: zitz
Date Posted: 30 November 2009 at 9:47am
My question is: why "const"?


-------------
Xtreme ToolkitPro v13.1.0, static, VC++6


Posted By: mgampi
Date Posted: 30 November 2009 at 3:10pm
Because GetTooltip does not change the content of the class!
Take a look at good C++ books about 'const correctness', e.g. 'Exeptional C++'...

If you really need a non-const version, you can cast the const away (const_cast<>), but this is not recommended.


-------------
Martin

Product: Xtreme Toolkit v 19.0.0, new Projects v 19.1.0
Platform: Windows 10 v 1909 (64bit)
Language: VC++ 2017


Posted By: zitz
Date Posted: 01 December 2009 at 1:03am
Martin, I know that this is not recommended (I am a little know C++  ) - Because of this I made a post on this forum.
Who said that GetTooltip does not change the content of the class? It is virtual and i want to change the content!
Does GetCaption change the content of the class? But it is not const!

I only told library's developers about the architectural limitations.


-------------
Xtreme ToolkitPro v13.1.0, static, VC++6



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