[SOLVED]Create a textBox always shows

wilsonwing

21-12-2008 06:38:30

Hi, me again...
I am trying to create a textBox that always shows.
But I have many different SceneManagers ( also many GUIManagers )
Is it possible that I don't need to create a textBox for each, and create only one textBox, which can always render to the viewport I am using at the time?
Something that it is like global.

kungfoomasta

21-12-2008 08:15:52

GUIManager::setSceneManager
GUIManager::setViewport


You could also create a Sheet and re-use the Sheet for each GUIManager you create:

Sheet* s = new Sheet("mySheet");
...
mGUIManager->setActiveSheet(s);


The first option is the easiest.

wilsonwing

21-12-2008 08:37:13

GUIManager::setSceneManager
GUIManager::setViewport


You could also create a Sheet and re-use the Sheet for each GUIManager you create:

Sheet* s = new Sheet("mySheet");
...
mGUIManager->setActiveSheet(s);


The first option is the easiest.

Yes, I know this :D
But this looks like I've to create a textBox for each of GUIManagers.

I am thinking to make it something like Singleton or global resource.
Is it possible? :?

ps.
The reason I want to implement this is because, when using chinese input, there is candidate words to be choose.
I've to make a textbox(or a listbox) to list the words, and the textbox should not be relate to any scenes.
So I can call it any time (any scene implemented a chat box) using Chinese input.

kungfoomasta

21-12-2008 08:54:23

What I'm saying is that you only need 1 GUIManager, and by updating the viewport and scenemanager, the GUIManager will draw the UI using the other scene managers.


SceneManager* sm1;
Camera* cam1;
Viewport* viewport1;

SceneManager* sm2;
Camera* cam2;
Viewport* viewport2;

mGUIManager->setSceneManager(sm1);
mGUIManager->setViewport(viewport1);
... // Change SceneManagers
mGUIManager->setSceneManager(sm2);
mGUIManager->setViewport(viewport2);


If you need to use multiple GUIManagers, they will need a Sheet to draw:


Sheet* s = new Sheet(...);
s->createTextBox(...);
...

mGUIManager1->setActiveSheet(s);
mGUIManager2->setActiveSheet(s);

wilsonwing

24-12-2008 02:33:00

Sorry for late reply.
I just want to make sure I can handle this before replying :wink:
I had a bad design and have to change many code for this design.
Now it works good.
Thank you again :D