Migration Problem from XTP8 to XTP12 |
Post Reply |
Author | |
lion
Groupie Joined: 04 March 2008 Status: Offline Points: 22 |
Post Options
Thanks(0)
Posted: 03 December 2008 at 4:28am |
Hello,
shortly we were mirgating from xtp8 to xtp12. There were hardly any issues. But now I have discovered a problem with popupmenus. In the picture u can see what the menu looks like. And this is what we used to do: when selecting a font with a style popupmenu (like in the screenshot) we fetched the index of the parent control to know which font was selected in the first place. Since we knew that a style (e.g. italic) was selected, but we did not know in which font. So knowing "italic" we got the parent's index and that way we knew what font was selected. This way we get the FontFamilyID and the style that was selected from the popup. Here is part of the code that is executed on popupmenu-selection: void CMainFrm::OnToolbarCtrlExec(UINT id, NMHDR* pNMHDR, LRESULT* pResult)now this does not work anymore in xtp12. The Problem is that "pParentControl" (as in the sourcecode above) is suddenly always NULL. Is that a problem here or is that a problem with the code generating the popup to begin with? Thanx very much for your help! Cheers Björn |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hello,
Yes it was changed in some 9-10.x version.
OnExecute event is called after Popup is already closed and "ControlPopup" already set to NULL :(
If you build this menu dynamically you can use Tag property to save parent information.
Or Create button class for these controls, override OnExecute method, etc.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
lion
Groupie Joined: 04 March 2008 Status: Offline Points: 22 |
Post Options
Thanks(0)
|
Thank you for your advice.
I tried it, but did not quite get to a solution. I wanted to write the index of the font popup menu in the MENUINFO of the font version menuitem, in order to be able to retrieve it later again, to know which font was selected. This is how the menu is created: HMENU hMenu = CreateMenu(); // the fonts menu HMENU hSubMenu; // the font versions menu for (i = 1; i <= NumItems; i++) hSubMenu = CreatePopupMenu(); for (j = 0; j < versionNum; j++) { AppendMenu(hSubMenu, MF_STRING, versionCounter++, versionLabels[j]); } AppendMenu(hMenu, MF_STRING|MF_POPUP, (UINT)hSubMenu, itemName); } I tried setting the MENUINFO on the hSubMenu but the values are not to be found when evaluating the "OnToolbarCtrlExec()" function. how do I get access to this with the code mentioned above earlier? Thanx in advance! Cheers Björn PS: is there a way to retrieve this original HMENU from the NMHDR* pNMHDR pointer inside "OnToolbarCtrlExec()" function ? |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Another option is to set
info.dwItemData with ::SetMenuItemInfo and then retieve it with pControl->GetTag();
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |