Game Development Community

GUIButton not showing

by Robert Schmidt · in Torque X 2D · 04/21/2008 (12:07 pm) · 0 replies

I've haven't found any examples of how to use this component and haven't found and forum topics that cover, and of course there is little to no documentation.

I have a control derived from GUIBitmap. I want to place a GUIButton on it. here is my init code;

GUIButtonStyle exitButtonStyle = new GUIButtonStyle();
exitButtonStyle.Bitmap = @"data\images\ExitButtonActive";
exitButtonStyle.Focusable = true;
exitButtonStyle.FontType = "Arial22";
exitButtonStyle.IsOpaque = true;
exitButtonStyle.HasBorder = false;
exitButtonStyle.PreserveAspectRatio = true;
exitButtonStyle.AutoSkin = true;

this._exitActive = new GUIButton();
this._exitActive.Name = "exitButton";
this._exitActive.Style = exitButtonStyle;
this._exitActive.OnGUIGainFocus = this.OnExitFocus;
this._exitActive.OnSelectedDelegate = this.OnExitSelected;
this._exitActive.Position = new Vector2(150, 200);
this._exitActive.Size = new Vector2(100, 50);
this._exitActive.Visible = true;
this._exitActive.Folder = this;
this._exitActive.ButtonText = "Exit";
this._exitActive.Layer = 1;

Problem is, when I run it there is no button. I have another bitmap on the same control which displays fine. Cleary I am missing something here. Any insights?

Thanks