Log in

View Full Version : Overriding windowlist right click?



PneumaPilot
March 7th, 2009, 22:02
I have a windowlist that stores an array of stats. It starts out empty and then you can add one generic stat line at a time until you get all the ones that you need. I thought it would be helpful, though, if you could right-click the area as if to add a new entry, but there would be another choice in the radial menu to add a common array of stats so that you would not have to input them one at a time (although I still want to leave that option available). Can anyone think of a way to do this? I can't even find the place where the icon_insert is ever used in the code that I have access to. Is this something that is built into the engine that cannot be changed?

Moon Wizard
March 8th, 2009, 01:06
When you give a windowlist the "allowcreate" tag, then it will automatically add the insert menu item and handle when a user selects the create option.

To create your own, remove the "allowcreate" tag, then add the following script code to the windowlist:



function onInit()
registerMenuItem("Create Item", "insert", 5);
end

function onMenuSelection(selection)
if selection == 5 then
local newentry = createWindow();
end
end


Once you understand how that works, you should be able to create a custom menu item to add a default stat. You want to use a different radial numbers and icons for the other menu options, and right after the createWindow call, you would want to set the appropriate values in the new window you just created. Also, you might want to look into creating another level of menu items, so that your top level can be "Create Standard Stat" and "Create Custom Stat", and under the standard category, you can have up to 7 sub-items.

Hope that helps,
JPG

PneumaPilot
March 8th, 2009, 01:47
Sweet! That's awesome. I'll play around with that for a while and see if I can get it to do what I want. Thanks.