Changes between Version 4 and Version 5 of documentation/tutorials/WindowTemplate

Show
Ignore:
Author:
peterc (IP: 192.168.0.1)
Timestamp:
01/08/08 14:37:12 (10 years ago)
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • documentation/tutorials/WindowTemplate

    v4 v5  
    471471We still have one last thing to implement; the title of the document isn't set on the title bar. We'll show you how to do this through the C++ API, but you can also easily do this through a scripting interface. 
    472472 
    473 The document is loaded on line 58 of main.cpp. Before the document is rendered, we want to get the 'span' element containing the dummy title and set its inner RML content to the title of the document we just loaded. To fetch the element, call the 'GetElementById()'. Once you have the element, you can remove all of its children and set new RML content with 'SetInnerRML()'. The document itself has the 'GetTitle()' function to fetch the title. 
     473The document is loaded on line 68 of main.cpp. Before the document is rendered, we want to get the 'span' element containing the dummy title and set its inner RML content to the title of the document we just loaded. To fetch the element, call the 'GetElementById()'. Once you have the element, you can remove all of its children and set new RML content with 'SetInnerRML()'. The document itself has the 'GetTitle()' function to fetch the title. 
    474474 
    475475{{{ 
    476476        // Load and show the tutorial document. 
    477477        Rocket::Core::ElementDocument* document = context->LoadDocument("data/tutorial.rml"); 
    478         document->GetElementById("title")->SetInnerRML(document->GetTitle()); 
    479         document->Show(); 
     478        if (document != NULL) 
     479        { 
     480                document->GetElementById("title")->SetInnerRML(document->GetTitle()); 
     481                document->Show(); 
     482        } 
    480483}}} 
    481484