TrackPopupMenu() and paritally disabled dialog box
Roland Pasternack -- rpasternack@MSERVER2.Legato.COM Tuesday, April 23, 1996 VC++ 4.1, NT 3.51 I have a tree control derived class that fills an MDI child window. By double clicking on an item in the tree, I post a WM_COMMAND to this same tree control that causes a modal dialog box to be displayed. This works perfectly. When right clicking in this tree on an item I display a popup menu via TrackPopupMenu(). When a menu command is chosen that displays the same dialog box as above, the dialog box comes up, but though the dialog box appears to have focus it does not work correctly. Clicking on the OK or cancel buttons with the left buttons does nothing. It appears that the tree control *underneath* the dialog box is still receiving the mouse messages, because when I right click on the dialog box, the popup menu for the *tree* appears on top of the dialog box. When I cause the popup menu to go away, the dialog box now works ok. It seems that for some reason the DoModal() is not giving control to the dialog box correctly. I have tried making the frame window the parent of the dialog box and of the popup menu, and this seems to have no effect. My best guess is that this has to do with the parent of the popup menu. Though I don't know why it would affect the DoModal(). Has anyone else run into a problem like this? If so, what was the problem and how did you solve it? Thanks, Roland
Dicky Singh -- Dicky@landmark.com Thursday, April 25, 1996 Are you trackpopupmenu-ing up on mouse down or up? Try on mouse up. Give it a shot. -Dicky ---------- From: Roland Pasternack[SMTP:rpasternack@MSERVER2.Legato.COM] Sent: Tuesday, April 23, 1996 2:43 p To: mfc-l@netcom.com Subject: TrackPopupMenu() and paritally disabled dialog box VC++ 4.1, NT 3.51 I have a tree control derived class that fills an MDI child window. By double clicking on an item in the tree, I post a WM_COMMAND to this same tree control that causes a modal dialog box to be displayed. This works perfectly. When right clicking in this tree on an item I display a popup menu via TrackPopupMenu(). When a menu command is chosen that displays the same dialog box as above, the dialog box comes up, but though the dialog box appears to have focus it does not work correctly. Clicking on the OK or cancel buttons with the left buttons does nothing. It appears that the tree control *underneath* the dialog box is still receiving the mouse messages, because when I right click on the dialog box, the popup menu for the *tree* appears on top of the dialog box. When I cause the popup menu to go away, the dialog box now works ok. It seems that for some reason the DoModal() is not giving control to the dialog box correctly. I have tried making the frame window the parent of the dialog box and of the popup menu, and this seems to have no effect. My best guess is that this has to do with the parent of the popup menu. Though I don't know why it would affect the DoModal(). Has anyone else run into a problem like this? If so, what was the problem and how did you solve it? Thanks, Roland ----------------------------- -Dicky Dicky@Landmark.COM Dragon Team
ToddAnderson -- andersto@NetHeaven.com Thursday, April 25, 1996 I had a similar problem a while back, I sent a WM_CANCELMODE Message to the offending window. If you can't find the window that still doing the mouse track you can get the mainfrm window from the App and do a SendMessageToDescendants. I think WM_CANCELMODE is what you are looking for. >VC++ 4.1, NT 3.51 > >I have a tree control derived class that fills an MDI child window. By double >clicking on an item in the tree, I post a WM_COMMAND to this same tree control >that causes a modal dialog box to be displayed. This works perfectly. > >When right clicking in this tree on an item I display a popup menu via >TrackPopupMenu(). When a menu command is chosen that displays the same dialog >box as above, the dialog box comes up, but though the dialog box appears to >have focus it does not work correctly. Clicking on the OK or cancel buttons >with the left buttons does nothing. It appears that the tree control >*underneath* the dialog box is still receiving the mouse messages, because when >I right click on the dialog box, the popup menu for the *tree* appears on top >of the dialog box. When I cause the popup menu to go away, the dialog box now >works ok. > >It seems that for some reason the DoModal() is not giving control to the >dialog box correctly. I have tried making the frame window the parent of the >dialog box and of the popup menu, and this seems to have no effect. My best >guess is that this has to do with the parent of the popup menu. Though I >don't know why it would affect the DoModal(). Has anyone else run into a >problem like this? If so, what was the problem and how did you solve it? > >Thanks, >Roland > >
| Вернуться в корень Архива |