Dialog Button executes code of 2 buttons [SOLVED]
-
On 19/06/2015 at 05:59, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R16
Platform: Mac OSX ;
Language(s) : C++ ;---------
Hi,I have a commandData plugin working together with a messageData plugin.
I have 2 buttons inside my GUI: DLG_BUTTON_1 and DLG_BUTTON_2.
If you press on them, they both send a GePrint with their value inside ("Pressed button 1/2").The problem is, if I press the first button, GePrint prints them both.
If I press the second button, GePrint only prints the second line.
Here is my code:Bool MyDialog::Command(Int32 id, const BaseContainer &msg) { switch (id) { case DLG_BUTTON_1: { BaseDocument *doc = GetActiveDocument(); Int32 modelMode1 = doc->GetMode(); if (modelMode1 == Mmodel) { GePrint("Pressed button 1"); } } case DLG_BUTTON_2: { BaseDocument *doc = GetActiveDocument(); Int32 modelMode2 = doc->GetMode(); if (modelMode2 == Mmodel) { GePrint("Pressed button 2"); } } } return true }
Does somebody know why this is happening?
And if I put code inside the if statement, will that be called 2 times as well?Thanks in advance for your help and time!
Greetings,
Casimir Smets -
On 19/06/2015 at 06:13, xxxxxxxx wrote:
Schoolboy error, you forgot to add the 'break' after each case.
Steve
-
On 19/06/2015 at 07:03, xxxxxxxx wrote:
Hi Steve,
Hahaha, feeling a little bit stupid now!
I'm glad I've got it working nowThanks for your answer!
Greetings,
Casimir Smets