View Full Version : Creating Submenus
Foen
March 18th, 2010, 21:44
Prolly a stoopid question, but how do you create submenus of a radial menu?
I get the registerMenuItem thing to create entries on a submenu, but how do I create the top-level item that links the main menu to a submenu?
Foen
Zeus
March 18th, 2010, 23:33
register your menus under the position number for the level you require:
e.g.
registerMenuItem("firstlevel", "num1", 8); -- registers toplevel menu
registerMenuItem("secondlevel", "num2", 8, 7); -- registers 2nd level under top level
registerMenuItem("thirdlevel", "num3", 8, 7, 6); -- registers 3rd level under 2nd level
Then in your onMenuSelection method include the levels you require as parameters.
function onMenuSelection(selection, subselection, subsubselection)
if selection == 8 then
if subselection == 7 then
if subsubselection == 6 then
-- call a method
end
end
...
end
Not sure if I understood your query though?
Foen
March 18th, 2010, 23:39
Hehe, you understood my question better than I did ;o)
I was expecting that I'd have to somehow handle the intermediate onMenuSelection event, and didn't know what to do with it (as the engine should handle it and load the next level down).
Thanks for the good advice.
Foen
Zeus
March 18th, 2010, 23:45
No probs. One other thing that caught me out that moon_wizard pointed out to me was that when registering submenus remember that FG assigns the opposite position to the submenu as the return to previous menu option.
Attempting to override this position will cause problems with menu events not firing correctly. Try to avoid this if you can.
e.g. for the 2nd level submenu in my example (at position 7) renders position position 3 in the 3rd level submenu as the return to Level 2 option.
Foen
March 19th, 2010, 06:02
Thanks, I hadn't taken account of that. Good job I asked!
Stuart
Powered by vBulletin® Version 4.2.1 Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.