You described your problem well, and did post relevant code so that is helpful; what wiki article are you referencing? Also, you should always post the error message (if it's an exception, catch and post the exception message) as well as the associated debug callstack. Basically, the more information you provide up front, the easier it will be for others to help you and the quicker your question will be answered. In case have not already seen this post, you will be doing yourself a favor by
reading this Unfortunately I am not familiar enough with the CEGUI's use of Lua, and without the error message I cannot even begin to look into the causes of it. All I can say, with the information you've given, is that the code you posted looks fine. And I believe that you can subscribe Lua functions to events for windows created in layouts - assuming the layout is loaded before the script executes that code.
If somebody helps you by replying to your thread,
upvote him/her as a thanks! Make sure to include your
CEGUI.log and
everything you tried when posting! And remember that we are not
magicians!