<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://cegui.org/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Chrisvj</id>
		<title>CEGUI Wiki - Crazy Eddie's GUI System (Open Source) - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="http://cegui.org/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Chrisvj"/>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/Special:Contributions/Chrisvj"/>
		<updated>2026-05-07T07:40:18Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.24.1</generator>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=CEGUI_In_Practice_-_Creating_widgets&amp;diff=4492</id>
		<title>CEGUI In Practice - Creating widgets</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=CEGUI_In_Practice_-_Creating_widgets&amp;diff=4492"/>
				<updated>2011-06-11T13:14:47Z</updated>
		
		<summary type="html">&lt;p&gt;Chrisvj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{VersionBadge|0.7}}&lt;br /&gt;
{{Series|CEGUI In Practice|2}}&lt;br /&gt;
&lt;br /&gt;
== CEGUI In-Practice 2 ==&lt;br /&gt;
&lt;br /&gt;
Welcome back.  This is the second installment of CEGUI In-Practice tutorial series.  In this we will build upon the previous tutorial, [[CEGUI In Practice - Introduction]].  We will show how to create Widgets and manage them.&lt;br /&gt;
&lt;br /&gt;
=== The Widget ===&lt;br /&gt;
&lt;br /&gt;
In the last example we showed how to bootstrap the system with Ogre, and gave a brief introduction to CEGUI's script files.  Now we will work on understanding what a widget is and how to use them.  Lets jump in and create a window which will display a box with an image in the middle of the screen:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tabs&amp;gt;&lt;br /&gt;
&amp;lt;tab title=&amp;quot;C++&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
CEGUI::Window *myImageWindow = CEGUI::WindowManager::getSingleton().createWindow(&amp;quot;TaharezLook/StaticImage&amp;quot;,&amp;quot;PrettyWindow&amp;quot; ); &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/tab&amp;gt;&lt;br /&gt;
&amp;lt;tab title=&amp;quot;Python&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
myImageWindow = PyCEGUI.WindowManager.getSingleton().createWindow(&amp;quot;TaharezLook/StaticImage&amp;quot;,&amp;quot;PrettyWindow&amp;quot; )&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/tab&amp;gt;&lt;br /&gt;
&amp;lt;/tabs&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CEGUI uses numerous derived classes code-side to create windows.  The base class CEGUI::Window is the generic window. the CEGUI::WindowManager calls a factory class when creating a window which returns the windows pointer. The first argument, &amp;quot;TaharezLook/StaticImage&amp;quot; tells the factory what kind of window to make.  These windows are defined in .scheme, which are subsequently defined more depth in other .xml files. The second argument is the name which the window will have.  &lt;br /&gt;
&lt;br /&gt;
[Note: As a point to note, there is no strict requirement on naming of windows, except to avoid repeat names.  Some users tend to prefer a naming convention using ParentName/ChildName.  ie.  &amp;quot;ConsoleWindow/SendButton&amp;quot; or &amp;quot;_MasterRoot/HealthBar&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
Once we have created the window, myImageWindow will be a pointer to a CEGUI::{{DoxygenClass|DefaultWindow|0.7}} which is derived from CEGUI::{{DoxygenClass|Window|0.7}}. If you look in the .scheme file you can see can see what a Widget is derived from via the TargetType= tag.&lt;br /&gt;
&lt;br /&gt;
Next we need to set some properties for this window. There are two ways of doing this. The first is via the propertyset, or the second way by calling the function. The latter way can be more annoying at times, as you may have to cast the window to the correct type to get access to the member functions, but may be more intuitive depending on how you think.&lt;br /&gt;
&lt;br /&gt;
=== The Unified Dimension System ===&lt;br /&gt;
&lt;br /&gt;
We created our widget, now we need to position it and define its size. Lets do that via code shall we?&lt;br /&gt;
&lt;br /&gt;
Before we jump in too far, we need to understand how CEGUI Handles positions. CEGUI Uses a Unified Dimension system. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;tabs&amp;gt;&lt;br /&gt;
&amp;lt;tab title=&amp;quot;C++&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
CEGUI::UDim(scale,offset);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/tab&amp;gt;&lt;br /&gt;
&amp;lt;tab title=&amp;quot;Python&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
PyCEGUI.UDim(scale,offset)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/tab&amp;gt;&lt;br /&gt;
&amp;lt;/tabs&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first number is the relative point on the screen between (0,1). So if we were looking at the X axis (left to right on the screen) a UDim(0.5,0) would be Halfway across the screen with zero pixels offset. Udim(0.0,50) would be starting at the left side of the screen +50 pixels. You can combine them too Udim(0.75,10) would be 3/4 of the way across the screen, with an additional 10 pixels.&lt;br /&gt;
&lt;br /&gt;
A point on the screen (or a UVector2) is made up of two UDims:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tabs&amp;gt;&lt;br /&gt;
&amp;lt;tab title=&amp;quot;C++&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
CEGUI::UVector2(UDim x,UDim y);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/tab&amp;gt;&lt;br /&gt;
&amp;lt;tab title=&amp;quot;Python&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
PyCEGUI.UVector2(UDim x, UDim y)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/tab&amp;gt;&lt;br /&gt;
&amp;lt;/tabs&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As such, a CEGUI::Rect is as you would imagine, 4 UDims&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tabs&amp;gt;&lt;br /&gt;
&amp;lt;tab title=&amp;quot;C++&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
CEGUI::URect(CEGUI::Udim left,CEGUI::Udim top,CEGUI::Udim right,CEGUI::Udim bottom);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/tab&amp;gt;&lt;br /&gt;
&amp;lt;tab title=&amp;quot;Python&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
PyCEGUI.URect(PyCEGUI.Udim left, PyCEGUI.Udim top, PyCEGUI.Udim right, PyCEGUI.Udim bottom)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/tab&amp;gt;&lt;br /&gt;
&amp;lt;/tabs&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So now that we know how positions are done, lets move our created window to the middle of the screen:&lt;br /&gt;
==== The Widget in Practice ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tabs&amp;gt;&lt;br /&gt;
&amp;lt;tab title=&amp;quot;C++&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
myImageWindow-&amp;gt;setPosition(CEGUI::UVector2(CEGUI::UDim(0.5,0),CEGUI::UDim(0.5,0)));&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/tab&amp;gt;&lt;br /&gt;
&amp;lt;tab title=&amp;quot;Python&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
myImageWindow.setPosition(PyCEGUI.UVector2(PyCEGUI.UDim(0.5,0), PyCEGUI.UDim(0.5,0)))&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/tab&amp;gt;&lt;br /&gt;
&amp;lt;/tabs&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That may look a little ugly but break it down. setPosition takes a UVector2, and each UVector2 is made up of an X and Y Udim, which is made up of a Scale and Absolute float. &lt;br /&gt;
&lt;br /&gt;
So, we have moved our window to the middle of the screen.. but CEGUI doesn't know how big to make it? So set its size to 150 pixels by 100 pixels [Note: I dropped the namespace for this to increase readability]. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tabs&amp;gt;&lt;br /&gt;
&amp;lt;tab title=&amp;quot;C++&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
myImageWindow-&amp;gt;setSize(UVector2(UDim(0,150),UDim(0,100)));&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/tab&amp;gt;&lt;br /&gt;
&amp;lt;tab title=&amp;quot;Python&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
myImageWindow.setSize(UVector2(UDim(0,150),UDim(0,100)));&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/tab&amp;gt;&lt;br /&gt;
&amp;lt;/tabs&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this case we specified the Udim using 0 for scales, and the actual pixel size in the absolute argument. The Absolute argument is additive to the scale, and in this case we didn't want to have the size be affected by the scale argument. If we were creating a splash screen that took up the entire window, we would likely want the size to be UVector2(UDim(1,0),UDim(1,0) with the position being at UVector2(Udim(0,0), UDim(0,0).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that we have created the window to the size we want. We need to tell it what image to display! That we will do by using the PropertySet as follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tabs&amp;gt;&lt;br /&gt;
&amp;lt;tab title=&amp;quot;C++&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
myImageWindow-&amp;gt;setProperty(&amp;quot;Image&amp;quot;,&amp;quot;set:TaharezLook image:full_image&amp;quot;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/tab&amp;gt;&lt;br /&gt;
&amp;lt;tab title=&amp;quot;Python&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
myImageWindow.setProperty(&amp;quot;Image&amp;quot;,&amp;quot;set:TaharezLook image:full_image&amp;quot;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/tab&amp;gt;&lt;br /&gt;
&amp;lt;/tabs&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first agument is what Property we want to set, and the second argument is what value to set. The second argument is a string broken into two pieces in this example. We need to know what ImageSet we are looking in, which is referenced following the 'set:' portion. And then the image via the 'image:' portion. In this case we want it to show the full_image.&lt;br /&gt;
&lt;br /&gt;
A Listing of properties for TaharezLook is available here [http://cegui.org.uk/static/TaharezLookProperties.html]&lt;br /&gt;
&lt;br /&gt;
Now that we have created the window. We need to attach it to the current root window.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tabs&amp;gt;&lt;br /&gt;
&amp;lt;tab title=&amp;quot;C++&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
CEGUI::System::getGUISheet()-&amp;gt;addChildWindow(myImageWindow);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/tab&amp;gt;&lt;br /&gt;
&amp;lt;tab title=&amp;quot;Python&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
PyCEGUI.System.getSingleton().getGUISheet().addChildWindow(myImageWindow)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/tab&amp;gt;&lt;br /&gt;
&amp;lt;/tabs&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will allow the Window to be displayed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Conclusion ====&lt;br /&gt;
&lt;br /&gt;
So with this quick tutorial we got a very short introduction to PropertySet usage (Important!) and a little bit about how the Unified Dimension System in CEGUI Works. While still not terribly useful, we're beginning to understand how to use some of CEGUI's faculties. Next up, we'll learn how to get some interactivity from this thing.&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Chrisvj</name></author>	</entry>

	<entry>
		<id>http://cegui.org/wiki/index.php?title=CEGUI_In_Practice_-_Using_.layout_files&amp;diff=4490</id>
		<title>CEGUI In Practice - Using .layout files</title>
		<link rel="alternate" type="text/html" href="http://cegui.org/wiki/index.php?title=CEGUI_In_Practice_-_Using_.layout_files&amp;diff=4490"/>
				<updated>2011-06-10T21:46:34Z</updated>
		
		<summary type="html">&lt;p&gt;Chrisvj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{VersionBadge|0.7}}&lt;br /&gt;
{{Series|CEGUI In Practice|5}}&lt;br /&gt;
&lt;br /&gt;
== CEGUI InPractice 5 ==&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will introduce how to use the .layout file.  This is likely what will be used for larger scale projects, where the art team isn't going to want to wait for you to recompile the source for every change they make.&lt;br /&gt;
&lt;br /&gt;
==== Meet the Layout ====&lt;br /&gt;
&lt;br /&gt;
The Layout file (.layout) is an xml file.  There exists at least two editors for layouts.  The first one is the  [[Downloads|CEGUI LayoutEditor]] This is a fairly mature editor.  Unfortunately it is deprecated and has not received any updates in sometime.  There is a new Editor (CEGUI Layout Editor 2) which is available from the SVN.  For the usage of this tutorial tho, we will not be using an editor and will be manipulating the .layout file with a plain old text editor.&lt;br /&gt;
&lt;br /&gt;
First thing to note, is its an XML file.  So proper XML formatting is required.  Second, is that it is hierarchical just like CEGUI.  We will work towards writing a Simple Console here.  I have created a console layout, and that will be the goal of this tutorial, to make a console editor like you would find in the various MMORPG's.  This is what we'll make today:&lt;br /&gt;
&lt;br /&gt;
[[File:TutorialInPractice-Console.jpg]]&amp;lt;br /&amp;gt;&lt;br /&gt;
Attached is the layout:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;GUILayout &amp;gt;&lt;br /&gt;
    &amp;lt;Window Type=&amp;quot;TaharezLook/FrameWindow&amp;quot; Name=&amp;quot;ConsoleRoot&amp;quot; &amp;gt;&lt;br /&gt;
        &amp;lt;Property Name=&amp;quot;Text&amp;quot; Value=&amp;quot;Chat Window&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Property Name=&amp;quot;TitlebarFont&amp;quot; Value=&amp;quot;DejaVuSans-10&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Property Name=&amp;quot;TitlebarEnabled&amp;quot; Value=&amp;quot;True&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Property Name=&amp;quot;UnifiedAreaRect&amp;quot; Value=&amp;quot;{{0.114991,0},{0.358182,0},{0.519469,0},{0.775455,0}}&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Window Type=&amp;quot;TaharezLook/Editbox&amp;quot; Name=&amp;quot;ConsoleRoot/EditBox&amp;quot; &amp;gt;&lt;br /&gt;
            &amp;lt;Property Name=&amp;quot;MaxTextLength&amp;quot; Value=&amp;quot;1073741823&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;Property Name=&amp;quot;UnifiedAreaRect&amp;quot; Value=&amp;quot;{{0.0201637,0},{0.787097,0},{0.694549,0},{0.957693,0}}&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;Property Name=&amp;quot;TextParsingEnabled&amp;quot; Value=&amp;quot;False&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;/Window&amp;gt;&lt;br /&gt;
        &amp;lt;Window Type=&amp;quot;TaharezLook/Button&amp;quot; Name=&amp;quot;ConsoleRoot/SendButton&amp;quot; &amp;gt;&lt;br /&gt;
            &amp;lt;Property Name=&amp;quot;Text&amp;quot; Value=&amp;quot;Send&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;Property Name=&amp;quot;UnifiedAreaRect&amp;quot; Value=&amp;quot;{{0.732211,0},{0.812349,0},{0.928283,0},{0.946832,0}}&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;/Window&amp;gt;&lt;br /&gt;
        &amp;lt;Window Type=&amp;quot;TaharezLook/Listbox&amp;quot; Name=&amp;quot;ConsoleRoot/ChatBox&amp;quot; &amp;gt;&lt;br /&gt;
            &amp;lt;Property Name=&amp;quot;UnifiedAreaRect&amp;quot; Value=&amp;quot;{{0.00534809,0},{0.0131038,0},{0.949636,0},{0.762443,0}}&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;/Window&amp;gt;&lt;br /&gt;
    &amp;lt;/Window&amp;gt;&lt;br /&gt;
&amp;lt;/GUILayout&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Okay, i'll admit. I cheated and used a LayoutEditor for this. But i'm allowed to, I know what I'm doing otherwise, so do don't back talk me and do your homework.&lt;br /&gt;
&lt;br /&gt;
Erm.  Anyway, lets look at the setup of the .layout file.&lt;br /&gt;
&lt;br /&gt;
the first line &amp;lt;xml..&amp;gt;  Is just the XML Declaration, and is not important for us.&lt;br /&gt;
&lt;br /&gt;
the next line &amp;lt;GUILayout &amp;gt;  begins the .layout file as far as CEGUI is concerned.&lt;br /&gt;
&lt;br /&gt;
Next up is: &amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;Window Type=&amp;quot;TaharezLook/FrameWindow&amp;quot; Name=&amp;quot;ConsoleRoot&amp;quot; &amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
This is where the meat begins.  As you can see we're creating a window of type &amp;quot;TaharezLook/FrameWindow&amp;quot; with the name &amp;quot;ConsoleRoot&amp;quot; the next lines:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;      &amp;lt;Property Name=&amp;quot;Text&amp;quot; Value=&amp;quot;Chat Window&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Property Name=&amp;quot;TitlebarFont&amp;quot; Value=&amp;quot;DejaVuSans-10&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Property Name=&amp;quot;TitlebarEnabled&amp;quot; Value=&amp;quot;True&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;Property Name=&amp;quot;UnifiedAreaRect&amp;quot; Value=&amp;quot;{{0.114991,0},{0.358182,0},{0.519469,0},{0.775455,0}}&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Change various PropertySets on that new framewindow.  It sets the font, Titlebar and the area.  these could also be done in code by calling:&lt;br /&gt;
&amp;lt;tabs&amp;gt;&lt;br /&gt;
&amp;lt;tab title=&amp;quot;C++&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;CEGUI::Window::setProperty(&amp;quot;TitlebarFont&amp;quot;,&amp;quot;DejaVuSans-10&amp;quot;);&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/tab&amp;gt;&lt;br /&gt;
&amp;lt;tab title=&amp;quot;Python&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
PyCEGUI.Window.setProperty(&amp;quot;TitlebarFont&amp;quot;,&amp;quot;DejaVuSans-10&amp;quot;)&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/tab&amp;gt;&lt;br /&gt;
&amp;lt;/tabs&amp;gt;&lt;br /&gt;
So as you can see, the scripts can be very useful allowing us to change properties outside of the code.  Giving the artists a great deal of usability!&lt;br /&gt;
&lt;br /&gt;
Anyway, the next line is &amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;       &amp;lt;Window Type=&amp;quot;TaharezLook/Editbox&amp;quot; Name=&amp;quot;ConsoleRoot/EditBox&amp;quot; &amp;gt;&lt;br /&gt;
            &amp;lt;Property Name=&amp;quot;MaxTextLength&amp;quot; Value=&amp;quot;1073741823&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;Property Name=&amp;quot;UnifiedAreaRect&amp;quot; Value=&amp;quot;{{0.0201637,0},{0.787097,0},{0.694549,0},{0.957693,0}}&amp;quot; /&amp;gt;&lt;br /&gt;
            &amp;lt;Property Name=&amp;quot;TextParsingEnabled&amp;quot; Value=&amp;quot;False&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;/Window&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You'll notice this is before the &amp;lt;/Window&amp;gt; of the ConsoleRoot, so it will be created as a child in of ConsoleRoot when the script is loaded in CEGUI. Can you tell what kind of window this will be? It will be an edit box. Thats the portion of the Console Window where the user will be able to type in what they want to say. I'm not going to go into detail about the rest of the windows, as they are pretty similar to the above examples. But &amp;quot;ConsoleRoot/SendButton&amp;quot; will be the send button, and &amp;quot;ConsoleRoot/ChatBox&amp;quot; will be where the chat messages will display to.&lt;br /&gt;
&lt;br /&gt;
[Note: As you can see I adopted the Naming scheme of Parent/Child window names. This is NOT required, but I think it helps make things easier to read on code side while debugging. You wouldn't want to just name it EditBox as that would be a pretty Common name, and may conflict with other windows you create later on in the application.]&lt;br /&gt;
&lt;br /&gt;
==== Applying our knowledge ====&lt;br /&gt;
&lt;br /&gt;
Now that we have gotten an introduction to the .layout file, we should learn how to implement this knowledge. How to get the layout file to show up in CEGUI.&lt;br /&gt;
&lt;br /&gt;
This code will load the layout into a new window:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tabs&amp;gt;&lt;br /&gt;
&amp;lt;tab title=&amp;quot;C++&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
CEGUI::Window *newWindow = CEGUI::WindowManager::getSingleton().loadWindowLayout(&amp;quot;MyConsole.layout&amp;quot;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/tab&amp;gt;&lt;br /&gt;
&amp;lt;tab title=&amp;quot;Python&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
newWindow = PyCEGUI.WindowManager.getSingleton().loadWindowLayout(&amp;quot;MyConsole.layout&amp;quot;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/tab&amp;gt;&lt;br /&gt;
&amp;lt;/tabs&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pretty self explanatory. There is something to note tho, you can add a prefix to the names in this .layout file. This would be useful if you're going to add the same .layout multiple times, because after the first load you'd get name conflicts. It would find a previous &amp;quot;ConsoleRoot&amp;quot; for example. So by calling this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tabs&amp;gt;&lt;br /&gt;
&amp;lt;tab title=&amp;quot;C++&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
CEGUI::Window *newWindow = CEGUI::WindowManager::getSingleton().loadWindowLayout(&amp;quot;MyConsole.layout&amp;quot;,&amp;quot;second_&amp;quot;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/tab&amp;gt;&lt;br /&gt;
&amp;lt;tab title=&amp;quot;Python&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
newWindow = PyCEGUI.WindowManager.getSingleton().loadWindowLayout(&amp;quot;MyConsole.layout&amp;quot;,&amp;quot;second_&amp;quot;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/tab&amp;gt;&lt;br /&gt;
&amp;lt;/tabs&amp;gt;&lt;br /&gt;
It would append &amp;quot;second_&amp;quot; to the window names (ie. &amp;quot;second_ConsoleRoot&amp;quot;); This will prevent naming errors.&lt;br /&gt;
&lt;br /&gt;
Now if we ran this right now would we be able to see the window?&lt;br /&gt;
&lt;br /&gt;
Nope. We haven't attached it to the window hierarchy have we?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tabs&amp;gt;&lt;br /&gt;
&amp;lt;tab title=&amp;quot;C++&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
CEGUI::System::getSingleton().getGUISheet()-&amp;gt;addChildWindow(newWindow);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/tab&amp;gt;&lt;br /&gt;
&amp;lt;tab title=&amp;quot;Python&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
PyCEGUI.system.getSingleton().getGuiSheet().addChildWindow(newWindow)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;/tab&amp;gt;&lt;br /&gt;
&amp;lt;/tabs&amp;gt;&lt;br /&gt;
Note: This assumes that you have a GUISheet already set, otherwise this will result in a segfault!&lt;br /&gt;
&lt;br /&gt;
==== Conclusion ====&lt;br /&gt;
&lt;br /&gt;
Well we showed how to load a .layout file. Sofar now we know how to Start the system with Ogre, create a window and understand properties, add input, process events, and load layouts. In the next tutorial we will apply this knowledge to create a console which actually does something! Till next time.&lt;br /&gt;
&lt;br /&gt;
This list of the Window properties may be helpful in creating your .layout files: [http://www.cegui.org.uk/docs/current/namespaceCEGUI_1_1WindowProperties.html Properties]&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Chrisvj</name></author>	</entry>

	</feed>