Dayz Explorer 1.28.160049
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)
41 Debug.ClearLogs();
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
void Add(string message, bool isReload=false)
void ScriptConsoleOutputTab(Widget root, ScriptConsole console, Widget button, ScriptConsoleTabBase parent=null)
TextListboxWidget m_ClientLogListbox
override bool OnClick(Widget w, int x, int y, int button)
void Clear(bool clearFile=false)
CheckBoxWidget m_ClientLogScrollCheckbox
override bool OnChange(Widget w, int x, int y, bool finished)
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