Creation/Dev/GScript/Understanding GUI Profiles: Difference between revisions
(→Available Attributes: Added text shadow attributes) |
|||
Line 32: | Line 32: | ||
== Available Attributes == | == Available Attributes == | ||
See [[Creation/Dev/Script/Client/GuiControlProfile|GuiControlProfile]]. | |||
== Editing control-specific profile information == | == Editing control-specific profile information == |
Revision as of 15:28, 17 September 2006
Introduction
GUI profiles are a set of characteristics that define how a GUI control looks. By default when you create a GUI control, it will be using the default profile for the control type; for example, "GuiButtonControl" by default uses "GuiButtonProfile".
This profile tells the program that this button needs to be red with a golden border and have orange text. It can define various things such as font face, size, colour, background colour, borders, images, etc.
A GUI profile is created in a similar way to a GUI control itself.
new GuiControlProfile("ProfileName") { attr = value; attr = value; }
It can then be applied to a control like so:
new GuiControl("ControlName") { profile = "ProfileName"; }
The control will then be formatted as is directed by the GUI profile.
An example profile looks like this:
new GuiControlProfile("MyProfile") { fillColor = {255, 0, 0}; fontColor = {255, 255, 255}; bitmap = "myEvilImage.png"; opaque = false; transparency = 0.5; }
Available Attributes
See GuiControlProfile.
Editing control-specific profile information
You can also edit the profile attributes of a single control. This is using the "profile" object of each GUI control.
The profile object contains members exactly the same as a normal GUI profile (i.e. "transparency" => "controlname.profile.transparency". This provides a way to edit the profile.
However! You must be careful. A variable, "useOwnProfile", plays an important role here. useOwnProfile tells the control not to share any changes made to the profile.
For example, if you did the following:
profile = "MyProfile"; profile.transparency = 1;
... then every control using the profile "MyProfile" would set transparency to 1.
useOwnProfile stops this happening:
profile = "MyProfile"; useOwnProfile = true; profile.transparency = 1;
... causes only the current control to have transparency set to 1.