Re: pop up menus?

by mjbysh(at)btinternet.com

 Date:  Thu, 29 Mar 2001 19:06:19 +0100
 To:  <hwg-style(at)hwg.org>
 References: 
  todo: View Thread, Original
Hi Roy,
    I had a good look back at my code to find out how I did the collison.
The method I used (i was suprised to descover) was area collision. It does
this by cheking that that the mouse X is greater than the top left of the
DIV and that the X is also less than the top left + the menu width etc.
Obviously this method requires fixed sizes for your tables. Each table can
be a different size (as large as the largest menu item on that table), but
that size must be set in advance in order for you to be able to check that
the mouse has not yet left this space. So you can dump the mouseOut code and
setup a times function that occurs every second say, that checks to see if
the mouse is outside of the active menu. If it is it deactivates it:

 if (mx <= menu.x || mx >= (menu.x+menu.width) || my <= menu.y || my >=
(menu.y+menu.height)){ // mx/y are mouse coords & menu is an object
containing your table dims
    // deactivate menu here
}

Hope that's clear. Let me know if you need further explanations.

Martin

HWG hwg-style mailing list archives, maintained by Webmasters @ IWA