Ok, I solved it. After creating the toolbar in the framewindow I checked
understand why I had to do that. I will do some reading tomorrow
(bedtime here) if no one has replied with an explanation when I wake up.
Joseph M. Newcomer wrote:
What are the strings? Show an example of one.
joe
Thanks for the quick reply. I hope I was able to explain my problem
properly (I'm not a native speaker). Here are the strings (along with
the other strings in of the several string tables in the resource file I
edited manually):
STRINGTABLE
BEGIN
ID_FILE_NEW "Create a new document\nNew"
ID_FILE_OPEN "Open an existing document\nOpen"
ID_FILE_CLOSE "Close the active document\nClose"
ID_FILE_SAVE "Save the active document\nSave"
ID_FILE_SAVE_AS "Save the active document with a new
name\nSave As"
// The string after \n is the the tooltip string, the string before it
is supposed to be the statusbar string
ID_BUTTON_1 "The first button\nfirst"
ID_BUTTON_2 "The second button\nsecond"
ID_BUTTON_3 "The third button\nthird"
ID_BUTTON_4 "The fourth button\nfourth"
END
I've added tooltips to my toolbar and that works just fine (displaying
what's after the \n), but what comes before is only displayed the
statusbar while its corresponding toolbar button i being pressed. If you
need any more info, I will deliver it.
On Wed, 30 May 2007 01:06:24 +0200, Eric Lilja
<mindcoolerremoveme@gmail.com> wrote:
Hello, I tried in my program to create a toolbar manually (I have a
class that derives from CToolBar) instead of modifying what the app
wizard generates for me. Everything works, except for one small thing:
The string associated with each button is only displayed in the
status bar while the button is being pressed, not when hovering above
it. Can that be fixed easily somehow? This was just an experiment
and it's a bit annoying that I could get everything working except
when the button string is displayed in status bar.
Here's how its created:
void
MyToolBar::Create(CWnd *parent)
{
VERIFY(CreateEx(parent, WS_CHILD | WS_VISIBLE | TBSTYLE_FLAT |
CBRS_FLYBY));
bitmap1 = load_button_image(IDB_BITMAP1);
bitmap2 = load_button_image(IDB_BITMAP2);
bitmap3 = load_button_image(IDB_BITMAP3);
bitmap4 = load_button_image(IDB_BITMAP4);
VERIFY(imagelist.Create(16, 15, ILC_COLOR24, 4, 1));
VERIFY(imagelist.Add(bitmap1, (CBitmap *)NULL) == 0);
VERIFY(imagelist.Add(bitmap2, (CBitmap *)NULL) == 1);
VERIFY(imagelist.Add(bitmap3, (CBitmap *)NULL) == 2);
VERIFY(imagelist.Add(bitmap4, (CBitmap *)NULL) == 3);
GetToolBarCtrl().SetImageList(&imagelist);
const UINT button_ids[] = { ID_BUTTON_1, ID_BUTTON_2, ID_BUTTON_3,
ID_SEPARATOR, ID_BUTTON_4 };
VERIFY(SetButtons(button_ids, sizeof(button_ids) /
sizeof(button_ids[0])));
}
- Eric
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm