Game Development Community

GUIBUTTON mouse-clicking

by Anthony Ayers · in Torque X 2D · 05/22/2008 (3:42 pm) · 1 replies

Could someone give me example of how one might do mouse-clicking with a GUIButton?

this is what I have...
GUIControl _inventoryCtrl = new GUIControl();

            GUIButtonStyle buttonStyle = new GUIButtonStyle();
            buttonStyle.Alignment = TextAlignment.JustifyCenter;
            buttonStyle.FillColor[CustomColor.ColorBase] = Microsoft.Xna.Framework.Graphics.Color.Turquoise;
            buttonStyle.Focusable = true;
            buttonStyle.FontType = "arial14";
            buttonStyle.IsOpaque = true;
            buttonStyle.TextColor[CustomColor.ColorBase] = Microsoft.Xna.Framework.Graphics.Color.Black;


                GUIButton guiButton = new GUIButton();
                guiButton.Style = buttonStyle;
                guiButton.Size = new Vector2(50, 25);
                guiButton.Position = new Vector2(20, 20);
                guiButton.ButtonText = "Button";
                guiButton.Name = "Button1";
                guiButton.Folder = _inventoryCtrl;
                guiButton.OnSelectedDelegate = GuiButtonSelected;
                guiButton.Bounds = new RectangleF(new Vector2(20, offset), new Vector2(50, 25));
                guiButton.Active = true;

thanks