Game Development Community

Quick Question about GUI in TorqueCombat

by Do Not Delete · in Torque X 2D · 08/02/2007 (10:18 pm) · 1 replies

I was reading through the MainMenuGUI file in Torque Combat and noticed that it had this.Style and so forth. What is this "this". I tried the same thing in my own project and it said Utopia.MainMenu' does not contain a definition for Style. Anyway I can fix this?

#1
08/03/2007 (3:37 pm)
Hi Dro,

"this" is keyword in C#. It refers to the current instance of the class. Every object has access to the "this" keyword to refer to itself. To use "this.Style" in your code, your class would need to contain a Style property definition or inherit one from its base class. In the case of the MainMenuGUI class, it inherits the Style property (and many others such as Size, Position, etc.) from the GUIBitmap class which in turn gets it from GUIControl.

- Al Hotchkiss