Some beginner questions

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

dna
Just popping in
Just popping in
Posts: 2
Joined: Fri May 06, 2011 11:53

Some beginner questions

Postby dna » Sat May 07, 2011 15:10

Hello,

I'm relatively new to CEGUI (Amazing work by the way) and I'm facing some strange behavior. I also have some questions. I'm sorry to gather all those stuff in a single post. I didn't like doing that but I promise there are small things.

1) I was looking for a method in the listbox class to remove every items from it. I didn't find anything in the API so I done it manually. Is there a better way doing that? have I miss something?

2) I load every window elements from layout files. For some reasons, on some of those windows I need to unregister every events that could be associated with those window right after the loading. But after calling removeAllEvents on a window I'm no more able to set some properties correctly (like the Text). For example if a called setText after removeAllEvents the windows didn't displays the new text. However other properties like Alpha or Visible keeps "working". I didnt look in the CEGUI code but I suppose some events are registered to update the window once setText is called and I just unregister them. So it's not trigged anymore and the window text isn't updated. But why other properties are still "working" ? What am I doing wrong?

3) I load some LUA scripts in the application but their functionalities are not needed the entire application's lifetime. How can I unload scripts from the script module? Have I to recreate a new module every time a LUA script become useless?


I didn't post CEGUI log because I'm not facing any errors. But if you want more informations, I will post log + code fragments.

Thanks for taking time to read this post. Any answers would be appreciated.
Cheers

PS: Sorry for my bad English!

Browser12
Not too shy to talk
Not too shy to talk
Posts: 42
Joined: Thu Jan 24, 2008 06:30
Location: UW-Madison
Contact:

Re: Some beginner questions

Postby Browser12 » Sat May 07, 2011 20:11

dna wrote:Hello,

I'm relatively new to CEGUI (Amazing work by the way) and I'm facing some strange behavior. I also have some questions. I'm sorry to gather all those stuff in a single post. I didn't like doing that but I promise there are small things.

1) I was looking for a method in the listbox class to remove every items from it. I didn't find anything in the API so I done it manually. Is there a better way doing that? have I miss something?


Just to answer the quick one, see the resetList() function:
http://cegui.org.uk/api_reference/class ... a7b06bafa5

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: Some beginner questions

Postby Kulik » Sat May 07, 2011 20:31

dna wrote:2) I load every window elements from layout files. For some reasons, on some of those windows I need to unregister every events that could be associated with those window right after the loading. But after calling removeAllEvents on a window I'm no more able to set some properties correctly (like the Text). For example if a called setText after removeAllEvents the windows didn't displays the new text. However other properties like Alpha or Visible keeps "working". I didnt look in the CEGUI code but I suppose some events are registered to update the window once setText is called and I just unregister them. So it's not trigged anymore and the window text isn't updated. But why other properties are still "working" ? What am I doing wrong?


I suspect CEGUI uses some events internally to react to text changes. This shouldn't be the case IMO so I will discuss this with CE for future versions. For now, only remove events you added yourself.

dna
Just popping in
Just popping in
Posts: 2
Joined: Fri May 06, 2011 11:53

Re: Some beginner questions

Postby dna » Sun May 08, 2011 16:09

Hello

Thank you for the answers.

Just to answer the quick one, see the resetList() function:
http://cegui.org.uk/api_reference/class ... a7b06bafa5

Well I failed my search session :s


I suspect CEGUI uses some events internally to react to text changes. This shouldn't be the case IMO so I will discuss this with CE for future versions. For now, only remove events you added yourself.

Ok thank you. I will do that.
I will investigate further. Maybe it's possible to remove only non CEGUI events. If you know something about that please let me know.

If someone didn't post some info about the LUA question this post can be closed.
Cheers!

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

Re: Some beginner questions

Postby CrazyEddie » Mon May 16, 2011 08:00

Yes, CEGUI uses events internally for certain compound widgets - I can't see this changing, since to change it will basically remove functionality.

The call to removeAllEvents physically removes the event objects themselves - not just subscribers. The correct way to unsubscribe is to keep the connection object returned when the subscription was made and use it subsequently to detach from the event. Depending on usage, one way to unsubscribe a batch of events is to use CEGUI::Event::ScopedConnection with a std::vector - when your vector goes out of scope (or is deleted) all the connections will be automatically dropped.

For the lua issue, I have no idea :?

CE


Return to “Help”

Who is online

Users browsing this forum: No registered users and 9 guests