public void Setup(UIWidget layout) { var dest = new AtomicEngine.Vector <AtomicEngine.UIWidget>(); layout.SearchWidgetClass("TBButton", dest); for (var ii = 0; ii < dest.Size; ii++) { dest[ii].SubscribeToEvent <WidgetEvent> (dest [ii], HandleUitexturewidgetEvent); } var cache = GetSubsystem <ResourceCache>(); UITextureWidget mytexturewidget = new UITextureWidget(); mytexturewidget.SetId("UITextureWidgetDemo"); Texture2D mytex = new Texture2D(); if (!mytex.Equals(null)) { mytex = cache.GetResource <Texture2D>("Textures/planet.jpg"); mytexturewidget.SetTexture(mytex); } mytexturewidget.SubscribeToEvent <WidgetEvent> (mytexturewidget, HandleUitexturewidgetEvent); UILayoutParams lpx = new UILayoutParams(); lpx.SetWidth(256); lpx.SetHeight(256); lpx.SetMinWidth(256); lpx.SetMinHeight(256); lpx.SetMaxWidth(256); lpx.SetMaxHeight(256); mytexturewidget.SetLayoutParams(lpx); UIWidget lower = layout.GetWidget("uitexturewidgetlower"); UIWidget mysvc = layout.GetWidget("uitwcontainer"); mysvc.AddChildBefore(mytexturewidget, lower); UILayout lo1 = new UILayout(); mysvc.AddChildBefore(lo1, lower); UIButton b1 = new UIButton(); b1.SetId("uitexturewidgetch1"); b1.SetText("Change texture to new build"); lo1.AddChild(b1); b1.SubscribeToEvent <WidgetEvent> (b1, HandleUitexturewidgetEvent); UIButton b2 = new UIButton(); b2.SetId("uitexturewidgetch2"); b2.SetText("Change texture to colorwheel"); lo1.AddChild(b2); b2.SubscribeToEvent <WidgetEvent> (b2, HandleUitexturewidgetEvent); UIButton b3 = new UIButton(); b3.SetId("uitexturewidgetch3"); b3.SetText("Change texture to planet"); lo1.AddChild(b3); b3.SubscribeToEvent <WidgetEvent> (b3, HandleUitexturewidgetEvent); }
void InitWindow() { var layout = new UILayout(); layout.Axis = UI_AXIS.UI_AXIS_Y; var checkBox = new UICheckBox(); checkBox.Id = "Checkbox"; layout.AddChild(checkBox); var button = new UIButton(); button.Text = "Button"; button.Id = "Button"; layout.AddChild(button); var edit = new UIEditField(); layout.AddChild(edit); edit.Id = "EditField"; window = new UIWindow(); window.Settings = UI_WINDOW_SETTINGS.UI_WINDOW_SETTINGS_TITLEBAR | UI_WINDOW_SETTINGS.UI_WINDOW_SETTINGS_CLOSE_BUTTON; window.Text = "Hello Atomic GUI!"; window.AddChild(layout); window.ResizeToFitContent(); UIView.AddChild(window); window.Center(); SubscribeToEvent <WidgetEvent>(window, e => { if (e.Type == UI_EVENT_TYPE.UI_EVENT_TYPE_CLICK) { var target = e.Target; if (target != null) { window.Text = $"Hello: {target.Id}"; } } }); SubscribeToEvent <WidgetDeletedEvent>(window, e => { BackToSelector(); }); }
void InitWindow() { var layout = new UILayout(); layout.Axis = UI_AXIS.UI_AXIS_Y; var checkBox = new UICheckBox(); checkBox.Id = "Checkbox"; layout.AddChild(checkBox); var button = new UIButton(); button.Text = "Button"; button.Id = "Button"; layout.AddChild(button); var edit = new UIEditField(); layout.AddChild(edit); edit.Id = "EditField"; window = new UIWindow(); window.Settings = UI_WINDOW_SETTINGS.UI_WINDOW_SETTINGS_TITLEBAR | UI_WINDOW_SETTINGS.UI_WINDOW_SETTINGS_CLOSE_BUTTON; window.Text = "Hello Atomic GUI!"; window.AddChild(layout); window.ResizeToFitContent(); UIView.AddChild(window); window.Center(); SubscribeToEvent<WidgetEvent>(window, e => { if (e.Type == UI_EVENT_TYPE.UI_EVENT_TYPE_CLICK) { var target = e.Target; if (target != null) { window.Text = $"Hello: {target.Id}"; } } }); SubscribeToEvent<WidgetDeletedEvent>(window, e => { BackToSelector(); }); }
protected void SimpleCreateInstructions(string text = "") { var layout = new UILayout(); layout.Rect = UIView.Rect; layout.LayoutPosition = UI_LAYOUT_POSITION.UI_LAYOUT_POSITION_RIGHT_BOTTOM; layout.LayoutDistributionPosition = UI_LAYOUT_DISTRIBUTION_POSITION.UI_LAYOUT_DISTRIBUTION_POSITION_RIGHT_BOTTOM; var fontDesc = new UIFontDescription(); fontDesc.Id = "Vera"; fontDesc.Size = 18; var label = new UIEditField(); label.FontDescription = fontDesc; label.ReadOnly = true; label.Multiline = true; label.AdaptToContentSize = true; label.Text = text; layout.AddChild(label); UIView.AddChild(layout); }
public override void Start() { var cache = GetSubsystem<ResourceCache>(); var graphics = GetSubsystem<Graphics>(); var ui = GetSubsystem<UI>(); graphics.SetWindowIcon(cache.Get<Image>("Textures/AtomicIcon48.png")); graphics.WindowTitle = "Atomic Game Engine Feature Example"; // Subscribe to Esc key: SubscribeToEvent<KeyDownEvent>(e => { if (e.Key == Constants.KEY_ESCAPE) BackToSelector(); }); // Say Hello var layout = new UILayout(); layout.Rect = UIView.Rect; layout.LayoutPosition = UI_LAYOUT_POSITION.UI_LAYOUT_POSITION_CENTER; layout.LayoutDistributionPosition = UI_LAYOUT_DISTRIBUTION_POSITION.UI_LAYOUT_DISTRIBUTION_POSITION_CENTER; var fontDesc = new UIFontDescription(); fontDesc.Id = "Vera"; fontDesc.Size = 24; var label = new UITextField(); label.FontDescription = fontDesc; label.Text = "Hello World, from the Atomic Game Engine"; layout.AddChild(label); UIView.AddChild(layout); }
public override void Start() { var cache = GetSubsystem<ResourceCache>(); var graphics = GetSubsystem<Graphics>(); var ui = GetSubsystem<UI>(); graphics.SetWindowIcon(cache.Get<Image>("Textures/UrhoIcon.png")); graphics.WindowTitle = "Atomic Game Engine Feature Example"; // Subscribe to Esc key: SubscribeToEvent<KeyDownEvent>(e => { if (e.Key == Constants.KEY_ESCAPE) BackToSelector(); }); // Say Hello var layout = new UILayout(); layout.Rect = UIView.Rect; layout.LayoutPosition = UI_LAYOUT_POSITION.UI_LAYOUT_POSITION_CENTER; layout.LayoutDistributionPosition = UI_LAYOUT_DISTRIBUTION_POSITION.UI_LAYOUT_DISTRIBUTION_POSITION_CENTER; var fontDesc = new UIFontDescription(); fontDesc.Id = "Vera"; fontDesc.Size = 24; var label = new UITextField(); label.FontDescription = fontDesc; label.Text = "Hello World, from the Atomic Game Engine"; layout.AddChild(label); UIView.AddChild(layout); }
public SampleSelector() { sampleRef = null; var rootLayout = new UILayout(); rootLayout.Axis = UI_AXIS.UI_AXIS_Y; rootLayout.Rect = UIView.Rect; UIView.AddChild(rootLayout); SubscribeToEvent <KeyDownEvent>(e => { if (e.Key == Constants.KEY_ESCAPE) { GetSubsystem <Engine>().Exit(); } }); #if ATOMIC_DESKTOP || ATOMIC_MOBILE var sampleTypes = typeof(Sample).Assembly.GetTypes().Where(t => t.IsSubclassOf(typeof(Sample)) && t != typeof(Sample)).ToArray(); foreach (var sample in sampleTypes) { var button = new UIButton(); button.Text = sample.Name; button.SubscribeToEvent <WidgetEvent>(button, e => { // We're only interested in clicks if (e.Type != UI_EVENT_TYPE.UI_EVENT_TYPE_CLICK) { return; } // set the event as handled, as the UI is about to go away e.Handled = true; // Goodbye UI UIView.RemoveChild(rootLayout); sampleRef = (Sample)Activator.CreateInstance(sample); sampleRef.Start(); UnsubscribeFromEvent <KeyDownEvent>(); }); rootLayout.AddChild(button); } #endif }
public SampleSelector() { sampleRef = null; var rootLayout = new UILayout(); rootLayout.Axis = UI_AXIS.UI_AXIS_Y; rootLayout.Rect = UIView.Rect; UIView.AddChild(rootLayout); SubscribeToEvent<KeyDownEvent>(e => { if (e.Key == Constants.KEY_ESCAPE) GetSubsystem<Engine>().Exit(); }); #if ATOMIC_DESKTOP || ATOMIC_MOBILE var sampleTypes = typeof(Sample).Assembly.GetTypes().Where(t => t.IsSubclassOf(typeof(Sample)) && t != typeof(Sample) ).ToArray(); foreach (var sample in sampleTypes) { var button = new UIButton(); button.Text = sample.Name; button.SubscribeToEvent<WidgetEvent>( button, e => { // We're only interested in clicks if (e.Type != UI_EVENT_TYPE.UI_EVENT_TYPE_CLICK) return; // set the event as handled, as the UI is about to go away e.Handled = true; // Goodbye UI UIView.RemoveChild(rootLayout); sampleRef = (Sample) Activator.CreateInstance(sample); sampleRef.Start(); UnsubscribeFromEvent<KeyDownEvent>(); }); rootLayout.AddChild(button); } #endif }
public override void Start() { Scene scene = AtomicNET.GetSubsystem <Player>().LoadScene("Scenes/Scene.scene"); Vector <Camera> cameras = new Vector <Camera>(); scene.GetComponents(cameras, true); Graphics graphics = GetSubsystem <Graphics>(); Renderer renderer = GetSubsystem <Renderer>(); int numCameras = cameras.Count; views = new UIView[numCameras]; renderer.SetNumViewports((uint)numCameras); int viewportWidth = graphics.Width / numCameras; for (int i = 0; i < numCameras; ++i) { Viewport viewport = new Viewport(scene, cameras[i]); viewport.Rect = new IntRect( i * viewportWidth, 0, (i + 1) * viewportWidth, graphics.Height); renderer.SetViewport((uint)i, viewport); UIView view = new UIView(); UILayout layout = new UILayout() { // See for a layout cheatsheet: https://github.com/AtomicGameEngine/AtomicGameEngine/wiki/Turbobadger-Layout-Cheat-Sheet // Specifies which y position widgets in a AXIS_X layout should have, or which x position widgets in a AXIS_Y layout should have. LayoutPosition = UI_LAYOUT_POSITION.UI_LAYOUT_POSITION_RIGHT_BOTTOM, // Specifies how widgets should be moved horizontally in a AXIS_X layout(or vertically in a AXIS_Y layout) if there is extra space available. LayoutDistributionPosition = UI_LAYOUT_DISTRIBUTION_POSITION.UI_LAYOUT_DISTRIBUTION_POSITION_RIGHT_BOTTOM, Rect = viewport.Rect }; layout.AddChild(new UITextField() { FontDescription = fontDescription, Text = cameras[i].Node.Name }); view.AddChild(layout); views[i] = view; } }
private void CreateSceneLoadButton(string sceneName) { UIButton emptyButton = new UIButton() { Text = sceneName, FontDescription = fontDescription, Gravity = UI_GRAVITY.UI_GRAVITY_NONE }; emptyButton.SubscribeToEvent <WidgetEvent>(emptyButton, (eventData) => { if (eventData.Type == UI_EVENT_TYPE.UI_EVENT_TYPE_CLICK) { var player = AtomicNET.GetSubsystem <Player>(); if (sceneName != "Clear") { if (currentScene != null) { // This tests that CSComponents (and other components) and cleaned up when keeping scene, though removing all the nodes currentScene.RemoveAllChildren(); } currentScene = player.LoadScene("Scenes/" + sceneName + ".scene"); player.SetCurrentScene(currentScene); } else { currentScene = null; player.UnloadAllScenes(); } GetSubsystem <ResourceCache>().ReleaseAllResources(true); System.GC.Collect(); } }); layout.AddChild(emptyButton); }
void CreateUI() { var cache = GetSubsystem <ResourceCache>(); var layout = new UILayout() { Axis = UI_AXIS.UI_AXIS_Y }; layout.Rect = UIView.Rect; UIView.AddChild(layout); // Create a scene which will not be actually rendered, but is used to hold SoundSource components while they play sounds scene = new Scene(); // Create buttons for playing back sounds foreach (var item in sounds) { var button = new UIButton(); layout.AddChild(button); button.Text = item.Key; button.SubscribeToEvent <WidgetEvent>(button, e => { if (e.Type == UI_EVENT_TYPE.UI_EVENT_TYPE_CLICK) { // Get the sound resource Sound sound = cache.Get <Sound>(item.Value); if (sound != null) { // Create a scene node with a SoundSource component for playing the sound. The SoundSource component plays // non-positional audio, so its 3D position in the scene does not matter. For positional sounds the // SoundSource3D component would be used instead Node soundNode = scene.CreateChild("Sound"); SoundSource soundSource = soundNode.CreateComponent <SoundSource>(); soundSource.Play(sound); // In case we also play music, set the sound volume below maximum so that we don't clip the output soundSource.Gain = 0.75f; // Set the sound component to automatically remove its scene node from the scene when the sound is done playing } } }); } // Create buttons for playing/stopping music var playMusicButton = new UIButton(); layout.AddChild(playMusicButton); playMusicButton.Text = "Play Music"; playMusicButton.SubscribeToEvent <WidgetEvent> (playMusicButton, e => { if (e.Type != UI_EVENT_TYPE.UI_EVENT_TYPE_CLICK) { return; } if (scene.GetChild("Music", false) != null) { return; } var music = cache.Get <Sound>("Music/StoryTime.ogg"); music.Looped = true; Node musicNode = scene.CreateChild("Music"); SoundSource musicSource = musicNode.CreateComponent <SoundSource> (); // Set the sound type to music so that master volume control works correctly musicSource.SetSoundType("Music"); musicSource.Play(music); }); var audio = GetSubsystem <Audio>(); // FIXME: Removing the music node is not stopping music var stopMusicButton = new UIButton(); layout.AddChild(stopMusicButton); stopMusicButton.Text = "Stop Music"; stopMusicButton.SubscribeToEvent <WidgetEvent>(stopMusicButton, e => { if (e.Type != UI_EVENT_TYPE.UI_EVENT_TYPE_CLICK) { return; } scene.RemoveChild(scene.GetChild("Music", false)); }); // Effect Volume Slider var slider = new UISlider(); layout.AddChild(slider); slider.SetLimits(0, 1); slider.Text = "Sound Volume"; slider.SubscribeToEvent <WidgetEvent>(slider, e => { if (e.Type != UI_EVENT_TYPE.UI_EVENT_TYPE_CHANGED) { return; } Log.Info($"Setting Effects to {slider.Value}"); audio.SetMasterGain("Effect", slider.Value); }); // Music Volume Slider var slider2 = new UISlider(); layout.AddChild(slider2); slider2.SetLimits(0, 1); slider2.Text = "Music Volume"; slider2.SubscribeToEvent <WidgetEvent>(slider2, e => { if (e.Type != UI_EVENT_TYPE.UI_EVENT_TYPE_CHANGED) { return; } Log.Info($"Setting Music to {slider2.Value}"); audio.SetMasterGain("Music", slider2.Value); }); }
public void Setup(UIWidget layout) { layoutomaticstr = "XGCPC"; var dest = new AtomicEngine.Vector <AtomicEngine.UIWidget>(); layout.SearchWidgetClass("TBButton", dest); for (var ii = 0; ii < dest.Size; ii++) { dest[ii].SubscribeToEvent <WidgetEvent> (dest [ii], HandleUilayoutEvent); } UILayout myc = (UILayout)layout.GetWidget("uilayoutcontainer"); // get the container layout UIButton tf0 = new UIButton(); // the layout-o-matic spawner tf0.SetText("LAYOUT-O-MATIC"); tf0.SetId("go_layout_config"); UILayout lo0 = new UILayout(); lo0.SetId("target_layout"); lo0.SetLayoutConfig("-----"); lo0.Load("Scenes/simp_button.ui.txt"); lo0.AddChildBefore(tf0, lo0.GetFirstChild()); myc.AddChild(lo0); // drop it in tf0.SubscribeToEvent <WidgetEvent> (tf0, HandleUilayoutEvent); UITextField tf1 = new UITextField(); tf1.SetText("layout config XACAC"); UILayout lo1 = new UILayout(); lo1.SetLayoutConfig("XACAC"); lo1.Load("Scenes/simp_button.ui.txt"); lo1.AddChildBefore(tf1, lo1.GetFirstChild()); myc.AddChild(lo1); UITextField tf2 = new UITextField(); tf2.SetText("layout config XGCAC"); UILayout lo2 = new UILayout(); lo2.SetLayoutConfig("XGCAC"); lo2.Load("Scenes/simp_button.ui.txt"); lo2.AddChildBefore(tf2, lo2.GetFirstChild()); myc.AddChild(lo2); UITextField tf3 = new UITextField(); tf3.SetText("layout config XPCAC"); UILayout lo3 = new UILayout(); lo3.SetLayoutConfig("XPCAC"); lo3.Load("Scenes/simp_button.ui.txt"); lo3.AddChildBefore(tf3, lo3.GetFirstChild()); myc.AddChild(lo3); UITextField tf4 = new UITextField(); tf4.SetText("layout config XACGC"); UILayout lo4 = new UILayout(); lo4.SetLayoutConfig("XACGC"); lo4.Load("Scenes/simp_button.ui.txt"); lo4.AddChildBefore(tf4, lo4.GetFirstChild()); myc.AddChild(lo4); UITextField tf5 = new UITextField(); tf5.SetText("layout config XGRGC"); UILayout lo5 = new UILayout(); lo5.SetLayoutConfig("XGRGC"); lo5.Load("Scenes/simp_button.ui.txt"); lo5.AddChildBefore(tf5, lo5.GetFirstChild()); myc.AddChild(lo5); UITextField tf6 = new UITextField(); tf6.SetText("layout config XPLGC"); UILayout lo6 = new UILayout(); lo6.SetLayoutConfig("XPLGC"); lo6.Load("Scenes/simp_button.ui.txt"); lo6.AddChildBefore(tf6, lo6.GetFirstChild()); myc.AddChild(lo6); UITextField tf7 = new UITextField(); tf7.SetText("layout config XACPC"); UILayout lo7 = new UILayout(); lo7.SetLayoutConfig("XACPC"); lo7.Load("Scenes/simp_button.ui.txt"); lo7.AddChildBefore(tf7, lo7.GetFirstChild()); myc.AddChild(lo7); UITextField tf8 = new UITextField(); tf8.SetText("layout config XGLPL"); UILayout lo8 = new UILayout(); lo8.SetLayoutConfig("XGLPL"); lo8.Load("Scenes/simp_button.ui.txt"); lo8.AddChildBefore(tf8, lo8.GetFirstChild()); myc.AddChild(lo8); UITextField tf9 = new UITextField(); tf9.SetText("layout config XPCPR"); UILayout lo9 = new UILayout(); lo9.SetLayoutConfig("XPCPR"); lo9.Load("Scenes/simp_button.ui.txt"); lo9.AddChildBefore(tf9, lo9.GetFirstChild()); myc.AddChild(lo9); }
void CreateUI() { var cache = GetSubsystem<ResourceCache>(); var layout = new UILayout() { Axis = UI_AXIS.UI_AXIS_Y }; layout.Rect = UIView.Rect; UIView.AddChild(layout); // Create a scene which will not be actually rendered, but is used to hold SoundSource components while they play sounds scene = new Scene(); // Create buttons for playing back sounds foreach (var item in sounds) { var button = new UIButton(); layout.AddChild(button); button.Text = item.Key; button.SubscribeToEvent<WidgetEvent>(button, e => { if (e.Type == UI_EVENT_TYPE.UI_EVENT_TYPE_CLICK) { // Get the sound resource Sound sound = cache.Get<Sound>(item.Value); if (sound != null) { // Create a scene node with a SoundSource component for playing the sound. The SoundSource component plays // non-positional audio, so its 3D position in the scene does not matter. For positional sounds the // SoundSource3D component would be used instead Node soundNode = scene.CreateChild("Sound"); SoundSource soundSource = soundNode.CreateComponent<SoundSource>(); soundSource.Play(sound); // In case we also play music, set the sound volume below maximum so that we don't clip the output soundSource.Gain = 0.75f; // Set the sound component to automatically remove its scene node from the scene when the sound is done playing } } }); } // Create buttons for playing/stopping music var playMusicButton = new UIButton(); layout.AddChild(playMusicButton); playMusicButton.Text = "Play Music"; playMusicButton.SubscribeToEvent<WidgetEvent> (playMusicButton, e => { if (e.Type != UI_EVENT_TYPE.UI_EVENT_TYPE_CLICK) return; if (scene.GetChild ("Music", false) != null) return; var music = cache.Get<Sound>("Music/StoryTime.ogg"); music.Looped = true; Node musicNode = scene.CreateChild ("Music"); SoundSource musicSource = musicNode.CreateComponent<SoundSource> (); // Set the sound type to music so that master volume control works correctly musicSource.SetSoundType ("Music"); musicSource.Play (music); }); var audio = GetSubsystem<Audio>(); // FIXME: Removing the music node is not stopping music var stopMusicButton = new UIButton(); layout.AddChild(stopMusicButton); stopMusicButton.Text = "Stop Music"; stopMusicButton.SubscribeToEvent<WidgetEvent>(stopMusicButton, e => { if (e.Type != UI_EVENT_TYPE.UI_EVENT_TYPE_CLICK) return; scene.RemoveChild(scene.GetChild("Music", false)); }); // Effect Volume Slider var slider = new UISlider(); layout.AddChild(slider); slider.SetLimits(0, 1); slider.Text = "Sound Volume"; slider.SubscribeToEvent<WidgetEvent>(slider, e => { if (e.Type != UI_EVENT_TYPE.UI_EVENT_TYPE_CHANGED) return; Log.Info($"Setting Effects to {slider.Value}"); audio.SetMasterGain("Effect", slider.Value); }); // Music Volume Slider var slider2 = new UISlider(); layout.AddChild(slider2); slider2.SetLimits(0, 1); slider2.Text = "Music Volume"; slider2.SubscribeToEvent<WidgetEvent>(slider2, e => { if (e.Type != UI_EVENT_TYPE.UI_EVENT_TYPE_CHANGED) return; Log.Info($"Setting Music to {slider2.Value}"); audio.SetMasterGain("Music", slider2.Value); }); }
private static void HandleUitabcontainerEvent(WidgetEvent ev) { UIWidget widget = (UIWidget)ev.Target; string refid = (string)ev.RefID; if (widget.Equals(null)) { return; } if (ev.Type == UI_EVENT_TYPE.UI_EVENT_TYPE_CLICK) { if (widget.GetId() == "uitabcontainercode") { AtomicMain.AppLog("UITabContainer support : " + widget.GetId() + " was pressed "); AtomicMain.ViewCode("Components/code_uitabcontainer.cs", widget.GetParent()); } if (widget.GetId() == "uitabcontainerlayout") { AtomicMain.AppLog("UITabContainer support : " + widget.GetId() + " was pressed "); AtomicMain.ViewCode("Scenes/layout_uitabcontainer.ui.txt", widget.GetParent()); } if (widget.GetId() == "uitabcontainerremove") { AtomicMain.AppLog("UITabContainer action : " + widget.GetId() + " was pressed "); UITabContainer tcx = (UITabContainer)widget.FindWidget("UITabContainerDemo"); int current = tcx.GetCurrentPage(); tcx.DeletePage(current); } if (widget.GetId() == "uitabcontaineradd") { AtomicMain.AppLog("UITabContainer action : " + widget.GetId() + " was pressed "); UITabContainer tcx = (UITabContainer)widget.FindWidget("UITabContainerDemo"); tcx.AddTabPageFile("New File", "Scenes/sheet.ui.txt"); } if (widget.GetId() == "uitabcontainermake") { AtomicMain.AppLog("UITabContainer action : " + widget.GetId() + " was pressed "); var cache = GetSubsystem <ResourceCache>(); UITabContainer tcx = (UITabContainer)widget.FindWidget("UITabContainerDemo"); UILayout lo = new UILayout(); lo.SetLayoutConfig("YAGAC"); // YACAC! UIEditField myeditfield = new UIEditField(); myeditfield.SetGravity(UI_GRAVITY.UI_GRAVITY_ALL); myeditfield.SetMultiline(true); File filex = cache.GetFile("Components/code_uitabcontainer.cs"); String textx = filex.ReadText(); filex.Close(); myeditfield.SetText(textx); UIFontDescription myfont = new UIFontDescription(); // put in a coder font myfont.SetSize(16); myfont.SetId("Vera"); myeditfield.SetFontDescription(myfont); lo.AddChild(myeditfield); tcx.AddTabPageWidget("New Code", lo); } if (widget.GetId() == "uitabcontainerundock") { AtomicMain.AppLog("UITabContainer action : " + widget.GetId() + " was pressed "); UITabContainer tcx = (UITabContainer)widget.FindWidget("UITabContainerDemo"); int current = tcx.GetCurrentPage(); tcx.UndockPage(current); } if (widget.GetId() == "uitabcontainerredock") { AtomicMain.AppLog("UITabContainer action : " + widget.GetId() + " was pressed "); UITabContainer tcx = (UITabContainer)widget.FindWidget("UITabContainerDemo"); if (!tcx.DockWindow("tab1")) { if (!tcx.DockWindow("tab2")) { if (!tcx.DockWindow("tab3")) { if (!tcx.DockWindow("New File")) { if (!tcx.DockWindow("New Code")) { AtomicMain.AppLog("UITabContainer action : no more windows to dock."); } } } } } } } }