Hello colleagues,
Seems strange, but after so many years, I'm trying to use MFC Feature Pack for my old application.
I have the following problem which makes me a bit crazy:
I have a toolbar, inside the toolbar I have 2 menu-buttons with drop-down style.
Menu in each button is built like:
id = ID of record in Database
text = text from Database
Both buttons are filled from different database tables. As a result IDs can be the same inside both menus!
Currently, when user press on the down arrow, menu is built on the fly. Also it's shown with TrackPopupMenu(), so immediately I have a result.
But when moving to Feature Pack, I have to replace buttons on the toolbar with CMFCToolBarMenuButton, and this class opens menu itself. When user clicks on a menu-item, message WM_COMMAND is sent with selected menu ID. But it doesn't provide (or I don't know where to find it) information about WHICH button/menu was pressed/clicked.
What I have tried:
The only thing I have in mind how to solve the problem: build static array of IDs, and when building menus fill this array like:
[unigue ID] / [database record ID]
So, when menu item is clicked, I can understand what menu it was and also what database record ID it was.
But it seems a bit... I don't know... but I don't like this approach, especially if somebody can advise me some more nice and logical solution.
UPD. The solution I'm searching for, should also work in case there are not 2, but 3 or more menu-buttons
Thanks in advance!