![]() |
Hanging when using OnInitCommandsPopup |
Post Reply ![]() |
Author | |
BruceW ![]() Newbie ![]() Joined: 05 April 2006 Location: United Kingdom Status: Offline Points: 21 |
![]() ![]() ![]() ![]() ![]() Posted: 10 April 2006 at 6:13am |
Hi, I have a very simple MDI example that I have been using to test ideas before incorporating them into my real application. I have been working on dynamic menus from the main menubar, using OnInitCommandsPopup. The routine gets called OK and some initial tests indicate that in principle I can do what I want. However the simple application hangs on the following code. void CMainFrame::OnInitCommandsPopup(CXTPPopupBar* pPopupBar) { // get the list of commands for the popup. CXTPControls* pControls = pPopupBar->GetControls(); // Iterate through the list looking for the entries with the // extension markers. CXTPControl* pFirst = pControls->GetFirst(); CXTPControl* pEntry = pFirst; long nIndex; CString caption; while (pEntry != NULL) { caption = pEntry->GetCaption(); nIndex = pEntry->GetIndex(); // If caption has extension marker, then include extended menus. // ... pEntry = pControls->GetAt( pControls->GetNext( nIndex, 1 ) ); // GetNext cycles to beginning, so check for end of list. if (pEntry == pFirst) { pEntry = NULL; } } } This is simple to reproduce in a basic MFC MDI program (mine has a couple of other examples in such as child window tabs, etc. so I have not tried taking all of the other code out), as follows: 1. Run application. 2. Select the standard 'Window' menu option, its menu should appear. 3. Drag mouse right to the 'View' menu option and its menu should appear. 4. Drag the mouse back to the 'Window' menu option, its menu should appear. 5. Drag the mouse back to the 'View' menu option. This will result in the application hanging. Any advice or help here would be much appreciated. Thanks, Bruce. |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
change loop to
for (int i = 0; i < pControls->GetCount(); i++) CXTPControl* pControl = pControls->GetAt(i); |
|
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 |