Changes between Version 4 and Version 5 of documentation/tutorials/WindowTemplate
- Timestamp:
- 01/08/08 14:37:12 (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
documentation/tutorials/WindowTemplate
v4 v5 471 471 We 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. 472 472 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.473 The 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. 474 474 475 475 {{{ 476 476 // Load and show the tutorial document. 477 477 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 } 480 483 }}} 481 484