Page 1 of 1

Some beginner questions

Posted: Sat May 07, 2011 15:10
by dna
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!

Re: Some beginner questions

Posted: Sat May 07, 2011 20:11
by Browser12
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

Re: Some beginner questions

Posted: Sat May 07, 2011 20:31
by Kulik
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.

Re: Some beginner questions

Posted: Sun May 08, 2011 16:09
by dna
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!

Re: Some beginner questions

Posted: Mon May 16, 2011 08:00
by CrazyEddie
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