Dayz Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Loading...
Searching...
No Matches
scriptconsoleoutputtab.c
Go to the documentation of this file.
2{
3 protected TextListboxWidget m_ClientLogListbox;
4 protected ButtonWidget m_ClientLogClearButton;
5 protected CheckBoxWidget m_ClientLogScrollCheckbox;
6
7 void ScriptConsoleOutputTab(Widget root, ScriptConsole console, Widget button, ScriptConsoleTabBase parent = null)
8 {
9 m_ClientLogListbox = TextListboxWidget.Cast(root.FindAnyWidget("TextListbox"));
10 m_ClientLogClearButton = ButtonWidget.Cast(root.FindAnyWidget("ButtonClear"));
11 m_ClientLogScrollCheckbox = CheckBoxWidget.Cast(root.FindAnyWidget("CheckBoxAutoScroll"));
13 }
14
16 {
17 }
18
19 override bool OnClick(Widget w, int x, int y, int button)
20 {
21 super.OnClick(w,x,y,button);
22
24 {
25 Clear(true);
26 return true;
27 }
28 return false;
29 }
30
31 override bool OnChange(Widget w, int x, int y, bool finished)
32 {
33 super.OnChange(w, x, y, finished);
34 return false;
35 }
36
37
38 protected void Clear(bool clearFile = false)
39 {
40 if(clearFile)
42 m_ClientLogListbox.ClearItems();
43 }
44
45 protected void Add(string message, bool isReload = false)
46 {
48 {
49 m_ClientLogListbox.AddItem(String(message), NULL, 0);
50
51 if (m_ClientLogScrollCheckbox.IsChecked())
52 {
53 m_ClientLogListbox.EnsureVisible(m_ClientLogListbox.GetNumItems());
54 }
55 }
56 }
57
58 protected void ReloadOutput()
59 {
60 Clear();
61 FileHandle file_index = OpenFile(Debug.GetFileName(), FileMode.READ);
62
63 if ( file_index )
64 {
65 string line_content;
66 while ( FGets( file_index, line_content ) != -1 )
67 {
68 Add(line_content, true);
69 }
70
71 CloseFile(file_index);
72 }
73 }
74
75}
Definition debug.c:2
static string GetFileName()
Definition debug.c:668
static void ClearLogs()
Definition debug.c:655
TextListboxWidget m_ClientLogListbox
override bool OnChange(Widget w, int x, int y, bool finished)
void Add(string message, bool isReload=false)
void Clear(bool clearFile=false)
CheckBoxWidget m_ClientLogScrollCheckbox
override bool OnClick(Widget w, int x, int y, int button)
void ScriptConsoleOutputTab(Widget root, ScriptConsole console, Widget button, ScriptConsoleTabBase parent=null)
void ScriptConsoleTabBase(Widget root, ScriptConsole console, Widget button, ScriptConsoleTabBase parent=null)
string String(string s)
Helper for passing string expression to functions with void parameter. Example: Print(String("Hello "...
Definition enscript.c:339
FileMode
Definition ensystem.c:383
proto void CloseFile(FileHandle file)
Close the File.
proto int FGets(FileHandle file, string var)
Get line from file, every next call of this function returns next line.
proto FileHandle OpenFile(string name, FileMode mode)
Opens File.
int[] FileHandle
Definition ensystem.c:390
Icon x
Icon y