How to Access the Top Level String in a Panel Hierarchical Menu?
-
Does anyone know how to access the top level string from a user's selection in a Panel?
-
Figured out—here's the code if anyone wants it:
-
When you call getPopupmenuItemText, set the last parameter to 0; this means don't truncate the menu text.
-
In the getPopupmenuItemText, substitute this code for the similar section:
for(element in array) {
if(element.indexOf("**") != -1) continue;
if(element.indexOf("___") != -1)continue;
if(index == i) {
// Remove the menu name
if(removeSub && element.indexOf("::") != -1) {
return element.split("::")[2];
} else {
local parsedString = element.split("::");
return parsedString[0]+": "+parsedString[2];
}
}
i++;
}
-
-
-