Help using keypress

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
Shap5202
Super Advanced
Super Advanced
Posts: 62
Joined: Thu Sep 29, 2005 2:36 pm

Help using keypress

Post by Shap5202 »

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.
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Hi,

Keypress Demo.

:)

Ruth
Shap5202
Super Advanced
Super Advanced
Posts: 62
Joined: Thu Sep 29, 2005 2:36 pm

Post by Shap5202 »

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?
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

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
Shap5202
Super Advanced
Super Advanced
Posts: 62
Joined: Thu Sep 29, 2005 2:36 pm

Post by Shap5202 »

Ok... update time :)

I modified my javascript method to do

Code: Select all

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: Select all

<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?
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

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://milonic.com/menu_methods.php

It's down toward the bottom of the page.

Ruth
Shap5202
Super Advanced
Super Advanced
Posts: 62
Joined: Thu Sep 29, 2005 2:36 pm

Post by Shap5202 »

Sorry, when i said underneath.. i meant behind. The position is correct.
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

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
Post Reply