From 83e41ce18871bf0747b07bc77e6129fe8592124f Mon Sep 17 00:00:00 2001 From: OTHGMars Date: Wed, 5 Aug 2020 03:57:29 -0400 Subject: [PATCH] inputTest Module Initialization Updates module initialization to use queueExec() for consistency with the ui module. This is required so all module dependencies (gui objects and profiles) are loaded before they're referenced. --- Templates/Modules/inputTest/inputTest.cs | 67 ++----------------- .../Modules/inputTest/scripts/menuButtons.cs | 59 ++++++++++++++++ 2 files changed, 65 insertions(+), 61 deletions(-) create mode 100644 Templates/Modules/inputTest/scripts/menuButtons.cs diff --git a/Templates/Modules/inputTest/inputTest.cs b/Templates/Modules/inputTest/inputTest.cs index 3391c31d4..231a43e03 100644 --- a/Templates/Modules/inputTest/inputTest.cs +++ b/Templates/Modules/inputTest/inputTest.cs @@ -13,67 +13,12 @@ function inputTest::destroy( %this ) function inputTest::initClient( %this ) { - exec("./scripts/customProfiles.cs"); - exec("./scripts/inputMonitor.cs"); - exec("./scripts/gui/inputMonitor.gui"); - exec("./scripts/joystickSettings.cs"); - exec("./scripts/gui/joystickSettings.gui"); - - if (isObject(MainMenuGui)) - { - %testBtn = new GuiButtonCtrl() { - text = "Input Event Monitor"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - position = "0 0"; - extent = "200 40"; - minExtent = "8 8"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "GuiBlankMenuButtonProfile"; - visible = "1"; - active = "1"; - command = "Canvas.pushDialog(InputMonitorDlg);"; - tooltipProfile = "GuiToolTipProfile"; - isContainer = "0"; - canSave = "0"; - canSaveDynamicFields = "0"; - }; - - if (!isObject(MMTestContainer)) - { - new GuiDynamicCtrlArrayControl(MMTestContainer) { - colCount = "0"; - colSize = "200"; - rowCount = "0"; - rowSize = "40"; - rowSpacing = "2"; - colSpacing = "0"; - frozen = "0"; - autoCellSize = "0"; - fillRowFirst = "1"; - dynamicSize = "1"; - padding = "0 0 0 0"; - position = "0 0"; - extent = "200 40"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "GuiDefaultProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "0"; - canSaveDynamicFields = "0"; - }; - MainMenuGui.add(MMTestContainer); - } - - MMTestContainer.add(%testBtn); - } + %this.queueExec("/scripts/customProfiles.cs"); + %this.queueExec("/scripts/inputMonitor.cs"); + %this.queueExec("/scripts/gui/inputMonitor.gui"); + %this.queueExec("/scripts/joystickSettings.cs"); + %this.queueExec("/scripts/gui/joystickSettings.gui"); + %this.queueExec("/scripts/menuButtons.cs"); } function onSDLDeviceConnected(%sdlIndex, %deviceName, %deviceType) diff --git a/Templates/Modules/inputTest/scripts/menuButtons.cs b/Templates/Modules/inputTest/scripts/menuButtons.cs new file mode 100644 index 000000000..471676a07 --- /dev/null +++ b/Templates/Modules/inputTest/scripts/menuButtons.cs @@ -0,0 +1,59 @@ +//----------------------------------------------------------------------------- +// Add buttons to the MainMenu after all other scripts have been exec'ed. +//----------------------------------------------------------------------------- + + if (isObject(MainMenuGui)) + { + %testBtn = new GuiButtonCtrl() { + text = "Input Event Monitor"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "0 0"; + extent = "200 40"; + minExtent = "8 8"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiBlankMenuButtonProfile"; + visible = "1"; + active = "1"; + command = "Canvas.pushDialog(InputMonitorDlg);"; + tooltipProfile = "GuiToolTipProfile"; + isContainer = "0"; + canSave = "0"; + canSaveDynamicFields = "0"; + }; + + if (!isObject(MMTestContainer)) + { + new GuiDynamicCtrlArrayControl(MMTestContainer) { + colCount = "0"; + colSize = "200"; + rowCount = "0"; + rowSize = "40"; + rowSpacing = "2"; + colSpacing = "0"; + frozen = "0"; + autoCellSize = "0"; + fillRowFirst = "1"; + dynamicSize = "1"; + padding = "0 0 0 0"; + position = "0 0"; + extent = "200 40"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "0"; + canSaveDynamicFields = "0"; + }; + MainMenuGui.add(MMTestContainer); + } + + MMTestContainer.add(%testBtn); + } \ No newline at end of file