Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - CXTPReportRecordItem::GetTooltip() and const
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTPReportRecordItem::GetTooltip() and const

 Post Reply Post Reply
Author
Message
zitz View Drop Down
Senior Member
Senior Member


Joined: 05 October 2008
Status: Offline
Points: 112
Post Options Post Options   Thanks (0) Thanks(0)   Quote zitz Quote  Post ReplyReply Direct Link To This Post Topic: CXTPReportRecordItem::GetTooltip() and const
    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
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post 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);

Back to Top
zitz View Drop Down
Senior Member
Senior Member


Joined: 05 October 2008
Status: Offline
Points: 112
Post Options Post Options   Thanks (0) Thanks(0)   Quote zitz Quote  Post ReplyReply Direct Link To This Post Posted: 30 November 2009 at 9:47am
My question is: why "const"?
Xtreme ToolkitPro v13.1.0, static, VC++6
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1198
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
zitz View Drop Down
Senior Member
Senior Member


Joined: 05 October 2008
Status: Offline
Points: 112
Post Options Post Options   Thanks (0) Thanks(0)   Quote zitz Quote  Post ReplyReply Direct Link To This Post 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
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.172 seconds.