home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / POPMENU.ZIP / POPFIX12.TXT next >
Text File  |  1989-11-14  |  3KB  |  77 lines

  1. #: 24439 S2/Environments [P]
  2.     02-Nov-89  08:33:34
  3. Sb: #POPMENU
  4. Fm: Paul Montgomery 71500,3525
  5. To: Charles Petzold PCMAG 72241,56 (X)
  6.  
  7. Ok,  In order to make the program work you need to add a WM_SHOW to your
  8. WinSetWindowPos in the handling of the mouse button.  It would also be
  9. better if you changed the MM_SELECTITEM msg to a MM_STARTMENUMODE msg.  That
  10. would allow the user to be able to select an item from the keyboard, without
  11. having to click on the menu.  More later.
  12.      Paul Montgomery
  13.  
  14. There is 1 Reply.
  15.  
  16. #: 24527 S2/Environments [P]
  17.     04-Nov-89  09:42:43
  18. Sb: #24439-POPMENU
  19. Fm: Charles Petzold [PCMAG] 72241,56
  20. To: Paul Montgomery 71500,3525 (X)
  21.  
  22. Yup, that does it.  Thanks a lot.
  23.  
  24. OK, here are the changes to POPMENU to get it to work under OS/2 1.2:
  25.  
  26.         1.  In the WinSetWindowPos call during WM_BUTTON2UP, use:
  27.  
  28.                 SWP_MOVE | SWP_SHOW
  29.  
  30.             as the last parameter.
  31.  
  32.         2.  Rather than call WinSendMsg with MM_SELECTITEM, use:
  33.  
  34.                 WinPostMsg (hwndMenuPopup, MM_STARTMENUMODE,
  35.                             MPFROM2SHORT (TRUE, FALSE), NULL) ;
  36.  
  37.             This allows a keyboard interface to the menu also, so the menu
  38.             items can have an underline.
  39.  
  40.         3.  Remove the call to WinSetCapture.  It is no longer needed.
  41.  
  42.                 Charles
  43.  
  44. #: 24441 S2/Environments [P]
  45.     02-Nov-89  08:42:29
  46. Sb: #POPMENU
  47. Fm: Paul Montgomery 71500,3525
  48. To: Charles Petzold PCMAG 72241,56 (X)
  49.  
  50. Ooops, I meant a SWP_SHOW instead of a WM_SHOW.  My fingers got crossed up.
  51.  
  52. There is 1 Reply.
  53.  
  54. #: 24447 S2/Environments [P]
  55.     02-Nov-89  10:54:42
  56. Sb: #24441-POPMENU
  57. Fm: Paul Montgomery 71500,3525
  58. To: Paul Montgomery 71500,3525 (X)
  59.  
  60. It appears that the WM_ADJUSTWINDOWPOS msg is not sent to frame controls
  61. during processing of the WinSetWindowPos if they are not visible.
  62. The IBM docs say that "if HWND specifies a frame
  63. window this function recalculates the sizes and positions of the frame
  64. controls.  If the new window rectangle for any frame control is empty,
  65. instead of resizing or repositioning that control, it is hidden if SWP_HIDE
  66. is specified.  This eliminates needless processing of windows that are not
  67. visible. "  In this case, hwndMenuPopup, is the handle of the frame
  68. surrounding the menu right?  Since, the menu is not a ActionBar menu but a
  69. submenu, the menu is created as an object window that is owned by hwnd.
  70. Object windows are created not visible.  When you change the parent to
  71. HWND_DESKTOP, you havent changed the visibility, so the WinSetWindowPos is
  72. done on a frame window that isnt visible. Thus none of the positioning is
  73. done.  So why is it in the lower left corner of the window?  I dunno.
  74.   Unless its original position is 0,0 during the LoadMenu.
  75. But, the 0,0 would change to be relative to HWND_DESKTOP instead of hwnd
  76. with the WinSetParent, I would think.  Am I close?
  77.