I need some help with a problem. I add a toolbar icon with NPPM_ADDTOOLBARICON message.
var
tb: TToolbarIcons;
begin
tb.ToolbarIcon := 0;
tb.ToolbarBmp := LoadImage(Hinstance, 'IDB_TB_TEST', IMAGE_BITMAP, 0, 0, (LR_DEFAULTSIZE or LR_LOADMAP3DCOLORS));
SendMessage(self.NppData.NppHandle, NPPM_ADDTOOLBARICON, WPARAM(self.FuncArray[1].CmdID), LPARAM(@tb));
The icon is added and it works, its just that the tool tip text on the button is wrong. It's either some text from a neighbor icon or something else. I also tried with tb being a static variable. Should not matter.
My question is, where does the text come from? In ToolBar.cpp the TB_ADDBUTTONS does not pass iString (also no strings are set with TB_ADDSTRING) and I can't find any usage of TB_SETBUTTONINFO. What gives?
Thanks.
-Zobo
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Happens when you dont have a Shortcut set for the particular command. Which version are you using? I thought the problem would go away when I introduced the new shortcutmapper (ie v4.8 RC).
The reason why you see some other name is (i think) a static string is used, so if it cant find the name because of a missing shortcut, the previous value is used because it isnt overridden.
If you like to find the section which handles the tooltips, look for TTN_GETDISPINFO.
-Harry
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi.
I need some help with a problem. I add a toolbar icon with NPPM_ADDTOOLBARICON message.
var
tb: TToolbarIcons;
begin
tb.ToolbarIcon := 0;
tb.ToolbarBmp := LoadImage(Hinstance, 'IDB_TB_TEST', IMAGE_BITMAP, 0, 0, (LR_DEFAULTSIZE or LR_LOADMAP3DCOLORS));
SendMessage(self.NppData.NppHandle, NPPM_ADDTOOLBARICON, WPARAM(self.FuncArray[1].CmdID), LPARAM(@tb));
The icon is added and it works, its just that the tool tip text on the button is wrong. It's either some text from a neighbor icon or something else. I also tried with tb being a static variable. Should not matter.
My question is, where does the text come from? In ToolBar.cpp the TB_ADDBUTTONS does not pass iString (also no strings are set with TB_ADDSTRING) and I can't find any usage of TB_SETBUTTONINFO. What gives?
Thanks.
-Zobo
Happens when you dont have a Shortcut set for the particular command. Which version are you using? I thought the problem would go away when I introduced the new shortcutmapper (ie v4.8 RC).
The reason why you see some other name is (i think) a static string is used, so if it cant find the name because of a missing shortcut, the previous value is used because it isnt overridden.
If you like to find the section which handles the tooltips, look for TTN_GETDISPINFO.
-Harry
Holy crap! It works. Adding a shortcut, even if an empty one, solves the problem.
Thanks!
-Zobo