Milonic provide full featured pull down web menus for some of the worlds largest companies
click here to see what it can do for you

Download Milonic DHTML Menu
Buy Milonic DHTML Menu

Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:29

Help using keypress


Poster: Shap5202
Dated: Sunday October 9 2005 - 2:06:24 BST

sorry for the perhaps simple question, but I hadn't seen it anywhere. What's the syntax to implement keypress trapping for the menus?

Thanks in advance.


Poster: Ruth
Dated: Sunday October 9 2005 - 2:43:42 BST

Hi,

Keypress Demo.

:)

Ruth


Poster: Shap5202
Dated: Sunday October 9 2005 - 20:55:54 BST

i had seen that.. maybe i just misunderstand how the module works. for example: Can you assign it so when i hit 's', it would open up a particular menu? Or you just tab to the menu and can then navigate it.

Or what about being able to hit a key, give focus to the menu, and then use the arrow keys to navigate it? Sounds like it might involve some scripting on my end?


Poster: Ruth
Dated: Monday October 31 2005 - 18:35:26 GMT

Hi,

Sorry for the slow response, I've been away. As far as I know the keypress module just makes the menu capable of using the tab key to tab the menu for those who need that option. I don't do scripts, you can probably create a script to assign things, but again, I don't know scripting.

Ruth


Poster: Shap5202
Dated: Wednesday November 2 2005 - 14:59:55 GMT

Ok... update time :)

I modified my javascript method to do

Code:
function pressed(){
   popup("mymenu");
  _popi(33);
}

So when i hit the correct key combination, "mymenu" correctly pops up, and the first item (itemref of 33) is selected, and I can then key through the menus using the keypress module.... HOWEVER there is one problem...
the menu is declared (abbreviated) as

Code:
<div>
with(milonic=new menuname("main")){
      alwaysvisible=1;
      orientation="horizontal";
      style=barMenuStyle;
      top=66;
      left=10;
                aI("showmenu=mymenu";);
                aI("text=other items";);
}

with(milonic=new menuname("mymenu")){
         style=mainStyle;
         overflow="scroll";         
         left=56;top=66;
                        aI("text=Item Ref 33";);
                        aI("text=Other items";);
}

drawMenus();
</div>


The menu i pop'ed up (mymenu) appears underneath the main horizontal menu so the first item is obscured by the horizontal bar. If I click and open "mymenu" first, close it, and THEN use my javascript method above, everything renders correctly. The only thing I can figure is some internal milonic method sets some values for display that the popup() function does not.

Any thoughts?


Poster: Ruth
Dated: Wednesday November 2 2005 - 16:44:04 GMT

Hi,

I'm sorry I don't have any thoughts on it. I know that for actual pop up menus you can set position, if these are just regular showmenu, then they should just automatically drop right below the horizontal menu. Maybe the info on the pop menus would give you some direction?

http://www.milonic.com/menu_methods.php

It's down toward the bottom of the page.

Ruth


Poster: Shap5202
Dated: Wednesday November 2 2005 - 17:43:15 GMT

Sorry, when i said underneath.. i meant behind. The position is correct.


Poster: Ruth
Dated: Wednesday November 2 2005 - 18:28:50 GMT

Shap5202 wrote:
The menu i pop'ed up (mymenu) appears underneath the main horizontal menu so the first item is obscured by the horizontal bar. If I click and open "mymenu" first, close it, and THEN use my javascript method above, everything renders correctly


Yes, I understood what you meant, the first item of the submenu is hidden by the horizontal menu, right?

OK, here's what I think is happening...not for any knowledge of the programming on position but because it seems logical based on the different things the program does as to submenu position.

1. With a horizontal main menu, subOffsetTop does not 'function' any submenu automatically opens at the 'bottom' of the horizontal menu.

2. The menu gets the position of the sub based on the position of the parent item.

3. When you use the keypress and your function to open the submenu BEFORE it has been opened by the mouse and therefore has found its position based on the internal programming and the position of the parent item it doesn't have a position figured for it.

4. With pop menus, when you open them, [this is more or less what you're doing with your function is opening the submenu as a pop up] when you open them using the pop function and just the menu name they will open based on the position set in the data file, however since the subOffsetTop isn't an active function with submenus opening from first level horizontal menus in essense there is no position set in the data file.

5. You can set offsets of pop ups if say it's opening based on an image on the page i.e. ("menuname","imagename",10,-10); Of course you don't have an image, but what I was wondering is if you could just eliminate the iamge part and include the offset part and see if that fixed your problem.

Now, having written all that, it may be totally wrong because I don't know programming, nor functions, it is just what seems logical based on what I do know about the spos and gpos from the methods and functions page, so put "I think" after each one of my statements and suggestions :) Maybe if you take a look at that methods and functions page you'll get a better idea of things as to the getting and setting of position?

Ruth