Creation/Dev/GScript/Understanding GUI Profiles: Difference between revisions
No edit summary |
(→Available Attributes: Added text shadow attributes) |
||
Line 64: | Line 64: | ||
opaque - boolean - controls whether the object is transparent or opaque | opaque - boolean - controls whether the object is transparent or opaque | ||
returntab - boolean | returntab - boolean | ||
shadowcolor - {red,green,blue} - specifies the color of the shadow (use in combination with textshadow=true) | |||
shadowoffset - array of format {offsetx,offsety} - specifies the position of the shadow (use in combination with textshadow=true) | |||
soundbuttondown - string - sound to play when the control is active | soundbuttondown - string - sound to play when the control is active | ||
soundbuttonover - string - sound to play when the control is rolled over | soundbuttonover - string - sound to play when the control is rolled over | ||
tab - boolean | tab - boolean | ||
textoffset - string - controls how far offset the text is from the top-left of the control | textoffset - string - controls how far offset the text is from the top-left of the control | ||
textshadow - boolean - enables or disables the shadow | |||
transparency - float - controls the transparency of the control</pre> | transparency - float - controls the transparency of the control</pre> | ||
Revision as of 15:15, 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
Here are the attributes that you can set in a GUI profile.
GuiControlProfile (TGraalVar): align - string - controls justification of text autosizeheight - boolean autosizewidth - boolean bitmap - string - the image map to be used with the control border - integer - border setting bordercolor - string - colour of the border bordercolorhl - string bordercolorna - string borderthickness - integer - thickness of the border cankeyfocus - boolean cursorcolor - string - colour of the cursor for editable text controls fillcolor - string fillcolorhl - string fillcolorna - string fontcolor - string fontcolorhl - string fontcolorlink - string fontcolorlinkhl - string fontcolorna - string fontcolorsel - string fontsize - integer - size of the font to be used fontstyle - string - font attribute (bold, italics, underline, ...) fonttype - string - name of the font to be used justify - string - the same like "align"; controls justification of text linespacing - integer - adjusts line spacing for multi-line controls modal - boolean mouseoverselected - boolean numbersonly - boolean opaque - boolean - controls whether the object is transparent or opaque returntab - boolean shadowcolor - {red,green,blue} - specifies the color of the shadow (use in combination with textshadow=true) shadowoffset - array of format {offsetx,offsety} - specifies the position of the shadow (use in combination with textshadow=true) soundbuttondown - string - sound to play when the control is active soundbuttonover - string - sound to play when the control is rolled over tab - boolean textoffset - string - controls how far offset the text is from the top-left of the control textshadow - boolean - enables or disables the shadow transparency - float - controls the transparency of the control
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.