Code::Blocks

User forums => Using Code::Blocks => Topic started by: cheshirekow on July 15, 2010, 11:57:39 am

Title: wxSmith: enums for IDs
Post by: cheshirekow on July 15, 2010, 11:57:39 am
Is there a way to configure wxSmith to use enums for IDs instead of "static const long". I understand the reasons for wanting to use static const long, but there are cases where I actually want an enum... for instance so I can use a switch(){} statement to case through all the possible IDs.
Title: Re: wxSmith: enums for IDs
Post by: stefanos_ on July 17, 2010, 11:37:37 am
why you think a switch() won't work with static const long? Have you try it? If not, give a shot and provide your results for further analysis by various volunteers.

Cheers.

stefanos_
Title: Re: wxSmith: enums for IDs
Post by: jens on July 17, 2010, 02:52:11 pm
why you think a switch() won't work with static const long? Have you try it? If not, give a shot and provide your results for further analysis by various volunteers.

Cheers.

stefanos_
It does not work, because the value is calculated at runtime with wxNewId() and that is not allowed in switch-statements.
Title: Re: wxSmith: enums for IDs
Post by: stefanos_ on July 18, 2010, 12:51:31 am
Indeed it provides unique IDs upon runtime. Next time, I should do my homework ;)p

For some reason I confused them with #defines.