# Группа виджетов

Группа виджетов представляет из себя простой класс-обёртку для виджетов, не создаваемых в методе Init класса UIScriptedMenu. Для использования класса необходимо переопределить следующие методы в наследуемом  классе:

```
protected Widget Init();
void RefreshText();
```

* Init - создаёт виджеты и возвращает корневой элемент. На каждом экземпляре вызывается строго один раз.
* RefreshText - обновить текст. Вызывается системой, когда необходимо гарантировать актуальность текста (например, при смене языка игре, для обновления локализации на отображаемых виджетах).&#x20;

Исходный код класса приведён ниже:

```clike
class MBSL_WidgetGroup : Managed
{
	protected Widget _Root;
	
	void MBSL_WidgetGroup()
	{
		MBSL_EventSystem.Subscribe(this, MBSL_DefaultClientEvents.ResetGUI);
	}
	
	private void ResetGUI()
	{
		if (_Root != null)
			RefreshText();
	}
	
	Widget GetRoot() 
	{
		if (_Root == null)
		{
			_Root = Init();
			RefreshText();
		}
			
		return _Root;
	}
	
	protected Widget Init() { return null; }
	
	void RefreshText() {}
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://workshop-guide.magicbyte.ru/mbsl-docs/ui/gruppa-vidzhetov.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
