Development :  K-Meleon Forum
K-Meleon development related discussions. 
Left hand
Posted by: dnasty
Date: May 19, 2008 12:21PM

Hello, im trying to show a warning(Javascript Alert) before the preferences dialog(edit >> preferences) opens. i have created my menu like this

Settinz{
}

&Tools{
!MailNews
!WebServices
!PrivacySecurity
-
#!Preferences
-
!Settinz
}


-------------
in my macro i have it like this,
-------------

launch_Settinz{
&noEng;
Pr&eferences=ID_PREFERENCES;
}

noEng{
alert("Be careful,This page controls the settings","Warning");
}

$_q="dee";
setmenu(Settinz,inline,$_q,2)
setmenu($_q,macro,"Set",launch_Settinz);

-------

When i run the menu, the alert works fine, then it bring an error alert like
LEFT HAND OF ASSIGNMENT MUST BE A VARIABLE.

what im i doing wrong?


regards

Options: ReplyQuote
Re: Left hand
Posted by: desga2
Date: May 19, 2008 04:45PM

This line:
Pr&eferences=ID_PREFERENCES;
Must be:
id("ID_PREFERENCES");

K-Meleon in Spanish

Options: ReplyQuote
Re: Left hand
Posted by: kko
Date: May 19, 2008 10:20PM

Quote
dnasty
what im i doing wrong?

1) No need to edit menus.cfg, you can do that all in your macro.
2) ID commands have to be called using the id() method (what desga2 mentioned).
3) Usage of setmenu() is a bit tricky. Look into menus.cfg to learn what menus/items you have to modify.


myPrefs.kmm:

myPrefs{
alert("Be careful,This page controls the settings","Warning");
id("ID_PREFERENCES");
}

_myPrefs_BuildMenu{
# Add the new item on top of the old:
setmenu(Preferences,macro,"Pr&eferences",myPrefs,ID_PREFERENCES);
# Remove the old item:
setmenu(Preferences,command,"",ID_PREFERENCES);
}
$OnInit=$OnInit."_myPrefs_BuildMenu;";

_myPrefs_SetAccels{
# Redirect the F2 accel too:
setaccel(VK_F2,"macros(myPrefs)");
}
$OnInit=$OnInit."_myPrefs_SetAccels;";


Options: ReplyQuote


K-Meleon forum is powered by Phorum.