_Yue
1
I want to activate an option, the following is disabled, how can I do ?, the code I have is as follows:
es_ES = GUI.Toggle(elementosMenu.espanol, es_ES, captionElementos.espanol);
if (es_ES == false)
{
es_ES = true;
}
else if (es_ES == true)
{
es_ES = false;
}
en_EN = GUI.Toggle(elementosMenu.ingles, en_EN, captionElementos.ingles);
if (en_EN == false)
{
en_EN = true;
}
else if (en_EN == true)
{
en_EN = false;
}
So basically what you want to accomplish is that only one language can be toggled right?
I don’t think a toggle is the best UI element for that. Have a look at something like the SelectionGrid or Toolbar.
If you want to do it with toggles and you only have two languages you can do it like that:
es_ES = GUI.Toggle(elementosMenu.espanol, es_ES, captionElementos.espanol);
es_ES = GUI.Toggle(elementosMenu.ingles, !es_ES, captionElementos.ingles);
By reusing the same boolean variable you ensure that it can only be true (meaning the language is Spanish) or false (meaning the language is English).
This is obviously not the best solution since it only allows two languages.
If you want to support unlimited amounts of languages you could do it like this:
es_ES = GUI.Toggle(elementosMenu.espanol, es_ES, captionElementos.espanol);
if(es_ES) en_EN = false;
en_EN = GUI.Toggle(elementosMenu.ingles, en_EN, captionElementos.ingles);
if(en_EN) es_ES = false;