[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4668: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3815)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4670: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3815)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4671: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3815)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4672: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3815)
XWidgetSoft Forum • View topic - HELP: creating modifying menu items within javascript CLOSED

XWidgetSoft Forum

XWidget & XLaunchpad , Desktop customization
It is currently April 16th, 2024, 1:55 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: July 29th, 2013, 9:17 am 
Offline
User avatar

Joined: July 29th, 2013, 9:13 am
Posts: 609
Is it possible to create/modify menu items within Xwidget javascript?
If so, please give some pointers, I am trying to replicate the following code:

for example:
mainWindow.onContextMenu = function() {
var items = [];
items[1] = new MenuItem();
items[1].title = "Online Help";
items[1].onSelect = function() {
widgethelp();
};
items[2] = new MenuItem();
items[2].title = "blah blah blah";
items[2].onSelect = function() {
donate();
};
items[3] = new MenuItem();
items[3].title = "blah blah blah";
items[3].onSelect = function() {
amazon();
};
items[4] = new MenuItem();
items[4].title = "blah blah blah";
items[4].onSelect = function() {
rocketdock();
};
items[5] = new MenuItem();
items[5].title = "";
items[5].onSelect = function() {
nullfunction();
};
items[6] = new MenuItem();
items[6].title = "See More blah blah blah;
items[6].onSelect = function() {
otherwidgets();
};
items[7] = new MenuItem();
items[7].title = "Download blah blah blah";
items[7].onSelect = function() {
update();
};
items[11] = new MenuItem();
items[11].title = "Contact blah blah blah";
items[11].onSelect = function() {
contact();
};
mainWindow.contextMenuItems = items;

I would also like to be able to modify the menus dynamically.


Last edited by yereverluvinuncleber on October 18th, 2014, 6:05 am, edited 2 times in total.

Top
 Profile  
 
PostPosted: August 1st, 2013, 6:53 pm 
Offline
User avatar

Joined: June 10th, 2012, 5:57 am
Posts: 313
new tutorial:


Top
 Profile  
 
PostPosted: August 2nd, 2013, 4:15 pm 
Offline
User avatar

Joined: July 29th, 2013, 9:13 am
Posts: 609
Thanks, but I know how to create the menu items using the gui, I just wanted to know If I can create menu items in code using a similar method as shown in the javascript above.


Top
 Profile  
 
PostPosted: August 8th, 2013, 4:29 am 
Offline
User avatar

Joined: July 29th, 2013, 9:13 am
Posts: 609
Hello, can anyone give any feedback as to whether this is possible?


Top
 Profile  
 
PostPosted: October 12th, 2014, 6:55 am 
Offline
User avatar

Joined: July 29th, 2013, 9:13 am
Posts: 609
BUMP

item = new MenuItem();

I am surprised this sort of thing can't be done, can it? It should be possible within the logic so more dynamic menus can be created on-the-fly.

<menu>
<item name="menuitem7" caption="Contact Support" onClick="menuitem7OnClick"/>
</menu>


Top
 Profile  
 
PostPosted: October 17th, 2014, 3:55 pm 
Offline

Joined: October 26th, 2013, 8:17 am
Posts: 362
i don't think there is a menuitem.create() function available,
but as another way:

1. create some more menuitems in gui,
2. use [OnPopupMenu] Event and add a function to it,
3. write the function to make them [.Visible],
4. you can also change [.Caption], [.Core], [.OnClick], [.Enabled], [.Checked], [.Tag], [.TagString] (this one is not available in gui :D) ,... through ScriptCode


Top
 Profile  
 
PostPosted: October 18th, 2014, 3:34 am 
Offline
User avatar

Joined: July 29th, 2013, 9:13 am
Posts: 609
Very useful and I will think about it. Changing this post to CLOSED.

Menu items cannot be created in code in Xwidget engine.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron

Powered by phpBB® Forum Software © phpBB Group