| //#CLIENTSIDE | |
| function onCreated() { | |
| showTraceGui(); | |
| } | |
| function showTraceGui() { | |
| if (findobject("TraceWin") != nil) findobject("TraceWin").destroy(); | |
| new GuiWindowCtrl("TraceWin") { | |
| profile = GuiBlueWindowProfile; | |
| text = "Function Call Tracer v1.0"; | |
| x = 200; y = 200; | |
| width = 550; height = 400; | |
| canclose = true; | |
| new GuiButtonCtrl("BtnGetTrace") { | |
| profile = GuiBlueButtonProfile; | |
| x = 10; y = 40; width = 120; height = 40; | |
| text = "Trace"; | |
| } | |
| new GuiButtonCtrl("BtnClearTrace") { | |
| profile = GuiBlueButtonProfile; | |
| x = 10; y = 90; width = 120; height = 40; | |
| text = "Clear"; | |
| } | |
| new GuiScrollCtrl("ScrollTrace") { | |
| profile = GuiBlueScrollProfile; | |
| x = 140; y = 40; width = 400; height = 350; | |
| hscrollbar = "dynamic"; | |
| vscrollbar = "always"; | |
| new GuiMLTextCtrl("TxtOutput") { | |
| profile = GuiBlueTextProfile; | |
| x = 0; y = 0; width = 370; | |
| text = "Waiting for trace data..."; | |
| } | |
| } | |
| } | |
| } | |
| function BtnGetTrace.onAction() { | |
| echo("Requesting call trace..."); | |
| getcalltrace(this, "onActionHook", 1000); | |
| } | |
| function BtnClearTrace.onAction() { | |
| if (findobject("TxtOutput") != nil) { | |
| TxtOutput.text = "Logs cleared."; | |
| echo("Trace logs cleared."); | |
| } | |
| } | |
| function onActionHook(temp.traceData) { | |
| if (findobject("TxtOutput") != nil) { | |
| TxtOutput.text = temp.traceData; | |
| if (findobject("ScrollTrace") != nil) { | |
| ScrollTrace.scrollto(0, 100000); | |
| } | |
| } | |
| } |