Game Development Community

GuiPopUpMenuCtrl - possible to disable menu items ?

by Orion Elenzil · in Torque Game Engine · 04/12/2006 (11:03 am) · 1 replies

Is it possible to disable an item in a pop-up menu ?

what is addScheme() ?

i can't quite get it to do much.

#1
04/12/2006 (12:06 pm)
Answer:

okay, there's sort of a way to do it w/ addScheme.

basically the schemes seem to be a way to assign a different coloring scheme to particular rows in the menu.

step 1:
add a scheme and give it a schemeID:
function MyGuiPopUpMenuCtrl::init(%this)
{
   // define schemeID 1 to be all grey
   %grey = "128 128 128";
   %this.addScheme(1, %grey, %grey, %grey);

Step 2:
Use that scheme ID when you add items to the menu:
%this.add("a disabled item",           0, 1);
   %this.add("a normal item",             1);
   }

- the first item appears disabled because the third parameter, "1", refers to a grey-grey-grey color scheme.