Listing 11

wnd<> w = _;
ptr<> surf = wnd_surface(w);
// finds a descendant surface, of type 'text', having the name "txt"
// throws, if not found
ptr<text> t = 
  surf->find_surface<text>("txt");
// finds a descendant surface having the name "txt" throws, if not found
ptr<> t2 = surf->find_surface("txt");
// finds a descendant surface, of type 'text', having the name "txt"
// if not found, returns null
ptr<text> t3 = 
  surf->try_find_surface<text>("txt");
// finds a descendant surface  having the name "txt"
// if not found, returns null
ptr<> t4 = 
  surf->try_find_surface("txt");