Herbert Menke writes in with information on implementing multiline tooltips in your program: If you want to have a multiline tooltip, you have to limit the width of a tooltip window, which requires a version of the comctl32 >= 4.70.
#ifndef WM_USER #define WM_USER 0x400 #endif #ifndef TTM_SETMAXTIPWIDTH #define TTM_SETMAXTIPWIDTH (WM_USER + 24 ) #endif #ifndef TTM_GETMAXTIPWIDTH #define TTM_GETMAXTIPWIDTH (WM_USER + 25 ) #endif // Receive tooltip WToolTip * tooltip = textb_1->GetToolTip(); // Get width of control WInt width = textb_1->GetWidth(); // and set the tooltip window to the same width tooltip->SendMessage( WMessage( TTM_SETMAXTIPWIDTH, 0, width ));
Extract from the documentation of Microsoft Internet Client SDK:
TTM_SETMAXTIPWIDTH wParam = 0; lParam = (LPARAM)(INT) iWidth;
Sets the maximum width for a tooltip window.
Returns an INT value that represents the previous maximum tooltip width. iWidth is the maximum tooltip window width to be set. The maximum tooltip width value does not indicate a tooltip window's actual width. Rather, if a tooltip string exceeds the maximum width, the control breaks the text into multiple lines, using spaces to determine line breaks. If the text cannot be segmented into multiple lines, it will be displayed on a single line. The length of this line may exceed the maximum tooltip width.
TTM_GETMAXTIPWIDTH wParam = 0; lParam = 0;
Retrieves the maximum width for a tooltip window.
Returns an INT value that represents the maximum tooltip width, in pixels. If no maximum width was set previously, the message returns -1. The maximum tooltip width value does not indicate a tooltip window's actual width. Rather, if a tooltip string exceeds the maximum width, the control breaks the text into multiple lines, using spaces to determine line breaks. If the text cannot be segmented into multiple lines, it will be displayed on a single line. The length of this line may exceed the maximum tooltip width.
Over the time every programmer has a bunch of classes he / she uses in almost every project. For instance, the author has made his own string class, derived from WString. In this tip I will refer to this extended class as WStringEx.
Since the development of WStringEx is an ongoing project, it's neccessary to add new member functions or to rewrite some code because of bugs of the WStringEx class from within several projects. But by just copying the source it's quite difficult to keep track of the latest version of the WStringEx class when you work on it.
As an example, think of working with the WStringEx class in one project A. You made some extensions, corrected some code and everything is fine. A day later, in another project B, you add another member function to WStringEx. Now you have two different versions of WStringEx in two different folders (in two different projects).
The solution is quite easy: Power++ has the ability to work with shortcuts to class sources (at the project level) instead of working on a copy of the source code. The author keeps all common classes in a folder I:\projects\Common\ (where I:\projects\ is the Power++ project folder, but it may be any other folder). This is the one and only location where the source code of WStringEx resides. Power++ can make a shortcut to the original file instead of copying it to your project's folder.
From then you can work with your WStringEx class the same way you would work with a class just defined for this project. But the source code remains in the Common folder and you work on one single source file from several projects.
The advantages of this approach are: