Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Steve Boulay on Jun 10, 2009 09:02
open dhtmlx forum
ContextMenu and HotKey

Thanks for the answer but your response concern only the image but not the hotkey.
When I use this code, i see the image at the right place but i don't see the hotkey in the context menu.

var menu=new dhtmlXMenuObject("menuObj","modern_red");
menu.renderAsContextMenu();
menu.setImagePath("./dhtmlxMenu/codebase/imgs/");
menu.setIconsPath("./dhtmlxMenu/samples/images/");
menu.addNewChild(menu.topId,0,"copy","Copy",false,"copy.gif","copy_dis.gif");
menu.setHotKey("copy","Ctrl+C");
menu.addNewChild(menu.topId,1,"cut","Cut",false,"cut.gif","cut_dis.gif");
menu.setHotKey("cut","Ctrl+X");
menu.addNewChild(menu.topId,2,"paste","Paste",true,"paste.gif","paste_dis.gif");
menu.setHotKey("paste","Ctrl+V");
menu.addNewSeparator("paste","s1");
menu.addNewChild(menu.topId,4,"help","Help",false);
menu.setHotKey("help","F1");

Answer posted by Alex (support) on Jun 10, 2009 09:39

Can the issue be reproduced in the sample that we provided you ?

Locally the hot keys are shown correctly (we've tested IE7, IE8 and FF3). 

Answer posted by Steve Boulay on Jun 11, 2009 00:09
I don't see the hotkey on my context menu. I have tried on IE6,IE8 and FF3.

This is my complete code :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="fr" xml:lang="fr">
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=UTF-8" />
<META HTTP-EQUIV="Last-Modified" CONTENT="0" />
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate" />
<META HTTP-EQUIV="Pragma" CONTENT="no-cache" />
<META HTTP-EQUIV="Expires" CONTENT="Tue, 09 Nov 1996 17:44:27 GMT" />
<META HTTP-EQUIV="X-UA-Compatible" CONTENT="IE=7" />
<META NAME="Robots" CONTENT="None" />
<TITLE>DHMTLX - TreeView</TITLE>
<script type="text/javascript" language="JavaScript" src="./dhtmlxMenu/sources/dhtmlxcommon.js" charset="utf-8"></script>
<script type="text/javascript" language="JavaScript" src="./dhtmlxMenu/sources/dhtmlxmenu.js" charset="utf-8"></script>
<link rel="stylesheet" type="text/css" href="./dhtmlxMenu/codebase/skins/dhtmlxmenu_modern_red.css" charset="utf-8">
</HEAD>
<BODY onclick='menu.hideContextMenu();'>
<div id="menuObj"></div>
<div  id='all' style='width:1000px;height:1000px;background-color:yellow;'>
<FORM  method=post action="cgi-bin/script.pl">
Enregistrement d'un utilisateur
<TABLE BORDER=0>
<TR>
    <TD>Nom</TD>
    <TD>
    <INPUT type=text name="nom">
    </TD>
</TR>

<TR>
    <TD>Prénom</TD>
    <TD>
    <INPUT type=text name="prenom">
    </TD>
</TR>

<TR>
    <TD>Sexe</TD>
    <TD>
    Homme : <INPUT type=radio name="sexe" value="M">
    <br>Femme : <INPUT type=radio name="sexe" value="F">
    </TD>
</TR>

<TR>
    <TD>Fonction</TD>
    <TD>
    <SELECT name="fonction">
        <OPTION VALUE="enseignant">Enseignant</OPTION>
        <OPTION VALUE="etudiant">Etudiant</OPTION>
        <OPTION VALUE="ingenieur">Ingénieur</OPTION>
        <OPTION VALUE="retraite">Retraité</OPTION>
        <OPTION VALUE="autre">Autre</OPTION>
    </SELECT>
    </TD>
</TR>
<TR>
    <TD>Commentaires</TD>
    <TD>
    <TEXTAREA rows="3" name="commentaires">
    Tapez ici vos commentaires</TEXTAREA>
    </TD>
</TR>

<TR>
    <TD COLSPAN=2>
    <INPUT type="submit" value="Envoyer">
    </TD>
</TR>
</TABLE>
</FORM>
</div>
<script language="JavaScript" charset="utf-8"> 
var menu=new dhtmlXMenuObject("menuObj","modern_red");
menu.renderAsContextMenu();
menu.setImagePath("./dhtmlxMenu/codebase/imgs/");
menu.setIconsPath("./dhtmlxMenu/samples/images/");
menu.setOpenMode("win");
menu.attachEvent("onBeforeContextMenu", function(zoneId){
menu.forEachItem(function(Id){menu.removeItem(Id);});
menu.addNewChild(menu.topId,0,"copy","Copy",false,"copy.gif","copy_dis.gif");
menu.setHotKey("copy","Ctrl+C");
//menu.setItemImage("copy","copy.gif","copy_dis.gif");
menu.addNewChild(menu.topId,1,"cut","Cut",false,"cut.gif","cut_dis.gif");
menu.setHotKey("cut","Ctrl+X");
//menu.setItemImage("cut","cut.gif","cut_dis.gif");
menu.addNewChild(menu.topId,2,"paste","Paste",true,"paste.gif","paste_dis.gif");
menu.setHotKey("paste","Ctrl+V");
//menu.setItemImage("paste","paste.gif","paste_dis.gif");
menu.addNewSeparator("paste","s1");
menu.addNewChild(menu.topId,4,"help","Help",false);
menu.setHotKey("help","F1");
return true;
});
menu.addContextZone("all");
</script>
</BODY>
</html>

Answer posted by Alex (support) on Jun 11, 2009 01:15

Possibly you use some old menu libraries. The issue doesn't appear with the latest menu files. Please, see attachment.

Attachments (1)
Answer posted by Steve Boulay on Jun 11, 2009 01:32
Thanks,

But i have download the last version of dhtmlxMenu and my file dhtmlxmenu.js in directory \dhtmlxMenu\sources\ is dated of 2009/03/10 for 89,4Ko and the file dhtmlxmenu.js in the archive is dated of 2009/06/10 for 89,7Ko and there is between us many differences. In the archive, you send me the sources version of the dhtmlxmenu.js, can i have the compact version too?

Answer posted by Alex (support) on Jun 11, 2009 08:47
The compressed dhtmlxmenu.js is attached
Attachments (1)