Results 1 to 5 of 5

Thread: Popup Menu Position

  1. #1
    Jordan
    Guest

    Popup Menu Position

    I created a popup menu through API, and I want it to act a certain way when it's near the edge of the screen. Usually, when you have a popup menu appear near the edge of the screen, if the menu is wider than the distance it popped from the edge, the menu will pop out from the opposite side (instead of popping to the lower-right, it will pop out to the lower-left).

    I want my menu, instead of opening to the other side, to hug the edge of the screen (where the mouse pointer will be somewhere between the left and right-most part of the menu).

    Any ideas on this?

  2. #2
    Matthew Gates
    Guest
    PopupMenu menuname, flags, x, y, boldcommand


    Where x and y are is where you put the coords to make your menu popup in a certain position, you can also ignore the flags parameter and put menuname, x, y.

  3. #3
    Megatron
    Guest
    He mentioned he was using API. I assume you are using TrackPopupMenu. The x and y coordinates are the 3rd and 4th arguments (shown below).
    Code:
    BOOL TrackPopupMenu(
      HMENU hMenu,         
      UINT uFlags,         
      int x,               
      int y,               
      int nReserved,       
      HWND hWnd,           
      CONST RECT *prcRect  
    );

  4. #4
    Jordan
    Guest
    Thanks, but thats not exactly what I'm looking for.

    Basically, I have a menu I created via API. I have it setup to popup to the lower-left of the cursor. However, when I'm close to the right side of the screen, the menu pops out to the lower-right.

    I want to stop that from happening. If I have my popup menu appear near the edge of the screen, (rather than pop out to the lower-right) I'd like to have it stay right next to the edge of the screen, so the menu is still right under the cursor.

    Thanks in advance!

  5. #5
    Megatron
    Guest
    The TPMPARAMS structure (passed through TrackPopupMenuEx) has an argument called rcExclude with specfies a rectangle with a portion of the screen you want to exclude.

    See if that works.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width