and now on to my problem:
as you can see I have a TabPane in the main rendering window, serving as my "main menu". if the user presses the "Load Mesh" button (top one), then I do pane->setEnabled(false), and I show my "LoadDialog", which is a seperate class. then, I set an event (to actually load the selected mesh), when the TabPane is Enabled (TabPane::EventEnabled).
then, when the user clicks the "OK" button in the OpenDialog window, it closes itself, and enables the TabPane... this triggers the event, and the system loads the mesh.
so far so good.
however, I also have an "AddPrimitive" button (2nd button from top). it works similarly. when the user clicks it, I dis-enable the TabPane, and show the AddPrimitiveDialog (another class). in the same way, when the user clicks OK, it enables the TabPane, and the event is triggered (this time adding a primitive to the scene).
the problem, as you have probably already guessed, is that the events "stack up". so, the first time I click OpenMesh, everything works fine. but if I try to open another mesh, it calls the OpenMesh function twice. If I click again, it calls the function (fires the event) 3 times! I assume this is because I am subscribing the event again, each time the button is clicked.
the reason I re-assign the event, is that I want a different function called when the TabPane is re-enabled, depending upon which button the user clicked.
I thought the solution would be to remove any events assigned to the TabPane after a command is complete. so I setup a simple bool variable "removeEvents". at the end of the last function in an event callback, I set this bool to "true". then in my main FrameListener, I check if the variable is true, and if it is, I call the pane->removeAllEvents() command, hoping to clear out all events assigned to this.
however it crashes, and I get an error in my CEGUI log:
Exception: No event named 'StartRender' is defined for this EventSet
so I think it's trying to delete events that don't even exist...
so to make a long story short...
as you can see, I'm trying to re-use a certain event for different purposes, by basically "over-writing" to callback function that I want to be called.... how should I be doing this?