Regaining access to console object

Keeto

17-04-2010 17:03:59

I'm trying to use the console for my game which does not use a mouse cursor at any point. The console is able to be toggled on and off by a key, and the first time it's created I call focusInputBox() on the console object to give the user the ability to type. However, after it's been toggled on and off, I kind of lose access to the object as a "console", and can only regain access of it as a "widget", which will not let me recall this focus command. Is there some way to get back this widget as a console object?

Keeto

17-04-2010 23:19:52

Actually, I just solved this myself after further studying the PlayPen code files. Incase anyone else looks for an answer like this:

To find a widget and return it as a certain type (in this case a QuickGUI::Console), you can do:
dynamic_cast<QuickGUI::Console*>(yourSheet->findWidget("yourConsoleWidgetsName"));

kungfoomasta

19-04-2010 07:59:44

Yep, dynamic cast will do it. :)

Shouldn't you just store a pointer to the console, for quick access?