Re: Switch Bug

new topic     » goto parent     » topic index » view thread      » older message » newer message
ghaberek said...

I'd like to implement a simple switch block to handle multiple event IDs from one handler. However, I'm having a problem and I hope I'm not just missing something. In the demo below, regardless of which menu item I select, it always jumps to the "Exit" block, except when I actually choose "Exit", then it jumps to the else block instead. Is this the same bug listed here? This demo was made with Euphoria 4.0.2 and wxEuphoria 0.15.0.

-Greg

I'm not sure I know what I'm talking about, but I think you need a break statement at the end of each case. Otherwise I think it executes all the cases starting at the one that matches. So for example in your code if id is equal to wxID_SAVE then I think message is getting set to "Save" then to "Save As" followed by "Print Setup" all the way down to "Exit".

So add a line that reads break after each message = ... line. For example:

case wxID_OPEN then 
    message = "Open" 
    break 
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu