Reuse Gui Controls?
by Omnigalactic · in Torque Game Engine · 05/20/2004 (9:01 pm) · 0 replies
How do I define a gui control then include it inside another gui control?
Specifically, what I have is an alert box, kind of a graphical version of the MessageBoxYesNo control. I have defined it within a GuiChunkedBitmapCtrl and that all works fine. But this particular alert box is very generic and I'd like to be able to use it in any other control as needed, without having to retype/copy & paste the definition each time. I tried simply replacing the definition with its reference name but got an error.
Here's some pseudo code...
(for the sake of brevity, I've stripped out the guts)
And here is how I'd like it to work for this and future gui elements...
Can this be done? How?
Thanks!
Specifically, what I have is an alert box, kind of a graphical version of the MessageBoxYesNo control. I have defined it within a GuiChunkedBitmapCtrl and that all works fine. But this particular alert box is very generic and I'd like to be able to use it in any other control as needed, without having to retype/copy & paste the definition each time. I tried simply replacing the definition with its reference name but got an error.
Here's some pseudo code...
(for the sake of brevity, I've stripped out the guts)
new GuiChunkedBitmapCtrl( MainMenuGui ) new GuiBitmapCtrl( GameStartGui ) new GuiBitmapButtonCtrl( GameStartNewButton ) new GuiBitmapButtonCtrl( GameStartLoadButton ) new GuiBitmapButtonCtrl( GameStartOnlineButton ) new GuiBitmapButtonCtrl( GameStartOptionsButton ) new GuiBitmapButtonCtrl( GameStartExitButton ) new GuiBitmapCtrl( AlertYesNoGui ) new GuiTextCtrl( AlertYesNoText ) new GuiBitmapButtonCtrl( AlertYesButton ) new GuiBitmapButtonCtrl( AlertNoButton )
And here is how I'd like it to work for this and future gui elements...
new GuiBitmapCtrl( AlertYesNoGui ) new GuiTextCtrl( AlertYesNoText ) new GuiBitmapButtonCtrl( AlertYesButton ) new GuiBitmapButtonCtrl( AlertNoButton ) new GuiChunkedBitmapCtrl( MainMenuGui ) new GuiBitmapCtrl( GameStartGui ) new GuiBitmapButtonCtrl( GameStartNewButton ) new GuiBitmapButtonCtrl( GameStartLoadButton ) new GuiBitmapButtonCtrl( GameStartOnlineButton ) new GuiBitmapButtonCtrl( GameStartOptionsButton ) new GuiBitmapButtonCtrl( GameStartExitButton ) AlertYesNoGui(notice the AlertYesNoGui definition at the end)
Can this be done? How?
Thanks!