Fetching the windowName

Forum for general chit-chat or off-topic discussion.

Moderators: CEGUI MVP, CEGUI Team

saurabh
Not too shy to talk
Not too shy to talk
Posts: 26
Joined: Mon Sep 28, 2009 19:06

Fetching the windowName

Postby saurabh » Tue Oct 13, 2009 04:49

Hi:

I am writing a multi page application. I load multiple layouts and assign each of them a name. Later when some button event happens, i wish to find that on which layout event occured...

I am doing this but program crashes without logging any error message.

CEGUI::WindowManager *wMgr = CEGUI::WindowManager::getSingletonPtr();
CEGUI::Window *win = wMgr->getWindow((CEGUI::utf8*)"RootWindow");
currentWin = win->getActiveChild()->getName();

Any clue on what is the correct way of achieving this...

Thanks
Saurabh

saurabh
Not too shy to talk
Not too shy to talk
Posts: 26
Joined: Mon Sep 28, 2009 19:06

Re: Fetching the windowName

Postby saurabh » Tue Oct 13, 2009 04:51

Crash is happening due to line...
currentWin = win->getActiveChild()->getName();

I am wondering about the role of getActiveChild api. What would it do? Will it return me the layout which i have set visible and attached as a child of rootWindow.

Thanks
Saurabh

saurabh
Not too shy to talk
Not too shy to talk
Posts: 26
Joined: Mon Sep 28, 2009 19:06

Re: Fetching the windowName

Postby saurabh » Tue Oct 13, 2009 05:01

I looked into API's documentation. The use getActiveChild() is peculiar.
I thought it'll return the pointer to layout which is active but it is returning a this pointer and also documentation does not say that what will be returned if input is focused on one of the child window and that window is active.

I am presuming that window being active means the window which is visible and has input focus. ...

so suppose we have
X--> Y ---> Z
X--> A ---> B

if Z is the textbox window with input focus then X->getActiveChild() should return pointer to Y .

Thanks
Saurabh

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Fetching the windowName

Postby CrazyEddie » Tue Oct 13, 2009 11:22

Hi,

The function is possibly poorly named (or at least the docs could be more specific), but this function is behaving in the way intended (and it's always been that way).

CE.

saurabh
Not too shy to talk
Not too shy to talk
Posts: 26
Joined: Mon Sep 28, 2009 19:06

Re: Fetching the windowName

Postby saurabh » Wed Oct 14, 2009 00:59

Hi:

I am trying to get the window name...
If suppose i declare a window with this line...

loginSheet = CEGUI::WindowManager::getSingletonPtr()->loadWindowLayout((CEGUI::utf8*)"loginlayout.layout", "LOGIN_WINDOW");
mWindow->addChildWindow(loginSheet);

where mWindow is CEGUI::Window *
Now if i do this...
mWindow->getChildAtIdx(id-1)->getName()

then what should it return. Problem is that i am not able to debug my code because once OGRE renders the sheet then if i press some button once, it just hangs instead of returning to break point and it does not allow me to see what is the output of mWindow->getChildAtIdx(id-1)->getName().

Problems:
1. Ideal output of mWindow->getChildAtIdx(id-1)->getName()
2. How to debug a after OGRE renders the layout. Instead of hitting break point, application just hangs if any event happens after that....

Thanks
Saurabh

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Fetching the windowName

Postby CrazyEddie » Wed Oct 14, 2009 09:21

Hi,

1) Depending upon the name of the top-level window in the layout file (here I'll assume 'Root' for the sake of simplicity), and assuming the index (id -1) accesses the window added in the line:

Code: Select all

mWindow->addChildWindow(loginSheet);

Then the name would be returned as "LOGIN_WINDOWRoot".

2) Nowhere near enough information given here. What OS? What compiler? Windowed or full-screen? What have you tried, exactly, to narrow down the issue? In this context, what does 'hang' mean?

CE.

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

Re: Fetching the windowName

Postby Jamarr » Thu Oct 15, 2009 19:05

Does your debugger not have a Break All command? You might also want to invest in logging...
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!

saurabh
Not too shy to talk
Not too shy to talk
Posts: 26
Joined: Mon Sep 28, 2009 19:06

Re: Fetching the windowName

Postby saurabh » Thu Oct 15, 2009 19:13

Hi,

It works perfectly.
I was not initializing the variable so crash was happening. Sorry for not providing enough details for post mar-tam...

But will take care next time...

Thank
Saurabh


Return to “Offtopic Discussion”

Who is online

Users browsing this forum: No registered users and 8 guests