Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_ServerConfigSaveDialogComponent.c
Go to the documentation of this file.
2 {
3  protected const int MIN_NAME_LENGTH = 5;
4 
5  protected const string WIDGET_FILE_NAME = "FileName";
6  protected const string WIDGET_NAV_CONFIRM = "confirm";
7 
8  protected SCR_EditBoxComponent m_FileName;
9  protected SCR_InputButtonComponent m_navConfirm;
10 
11  //------------------------------------------------------------------------------------------------
12  override protected void Init(Widget root, SCR_ConfigurableDialogUiPreset preset, MenuBase proxyMenu)
13  {
14  super.Init(root, preset, proxyMenu);
15  m_navConfirm = FindButton(WIDGET_NAV_CONFIRM);
16  }
17 
18  //------------------------------------------------------------------------------------------------
19  override void HandlerAttached(Widget w)
20  {
21  m_FileName = SCR_EditBoxComponent.GetEditBoxComponent(WIDGET_FILE_NAME, w);
22  if (!m_FileName)
23  return;
24 
25  m_FileName.m_OnChanged.Insert(OnFileNameChanged);
26 
27  Widget focus = m_FileName.GetRootWidget();
28  if (focus)
29  GetGame().GetWorkspace().SetFocusedWidget(focus);
30  }
31 
32  //------------------------------------------------------------------------------------------------
33  void SetFileNameText(string text)
34  {
35  if (!m_FileName)
36  return;
37 
38  m_FileName.SetValue(text);
39  }
40 
41  //------------------------------------------------------------------------------------------------
42  string GetFileNameText()
43  {
44  if (!m_FileName)
45  return "";
46 
47  return m_FileName.GetValue();
48  }
49 
50  //------------------------------------------------------------------------------------------------
52  protected void OnFileNameChanged(SCR_EditBoxComponent editBox, string text)
53  {
54  if (m_navConfirm)
55  m_navConfirm.SetEnabled(text.Length() >= MIN_NAME_LENGTH);
56  }
57 }
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_ConfigurableDialogUiPreset
Configuration for a dialog.
Definition: SCR_ConfigurableDialogUI.c:809
SCR_ServerConfigSaveDialog
Definition: SCR_ServerConfigSaveDialogComponent.c:1
SCR_ConfigurableDialogUi
Definition: SCR_ConfigurableDialogUI.c:13
SCR_EditBoxComponent
Definition: SCR_EditBoxComponent.c:8
FindButton
SCR_InputButtonComponent FindButton(string tag)
Returns a button with given tag.
Definition: SCR_BrowserHoverTooltipComponent.c:116
SCR_InputButtonComponent
Definition: SCR_InputButtonComponent.c:1