XWidgetSoft Forum https://bbs.xwidget.com/ |
|
HELP: creating modifying menu items within javascript CLOSED https://bbs.xwidget.com/viewtopic.php?f=8&t=3425 |
Page 1 of 1 |
Author: | yereverluvinuncleber [ July 29th, 2013, 9:17 am ] |
Post subject: | HELP: creating modifying menu items within javascript CLOSED |
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. |
Author: | qiancang [ August 1st, 2013, 6:53 pm ] |
Post subject: | Re: creating modifying menu items within javascript |
new tutorial: |
Author: | yereverluvinuncleber [ August 2nd, 2013, 4:15 pm ] |
Post subject: | Re: creating modifying menu items within javascript |
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. |
Author: | yereverluvinuncleber [ August 8th, 2013, 4:29 am ] |
Post subject: | Re: creating modifying menu items within javascript |
Hello, can anyone give any feedback as to whether this is possible? |
Author: | yereverluvinuncleber [ October 12th, 2014, 6:55 am ] |
Post subject: | Re: HELP: creating modifying menu items within javascript |
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> |
Author: | hamid [ October 17th, 2014, 3:55 pm ] |
Post subject: | Re: HELP: creating modifying menu items within javascript |
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 ) ,... through ScriptCode |
Author: | yereverluvinuncleber [ October 18th, 2014, 3:34 am ] |
Post subject: | Re: HELP: creating modifying menu items within javascript |
Very useful and I will think about it. Changing this post to CLOSED. Menu items cannot be created in code in Xwidget engine. |
Page 1 of 1 | All times are UTC - 8 hours |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |