When to use #PB_Any instead of enumerated IDs
Posted: Wed Aug 17, 2022 4:59 pm
Example 1 - Fails
Later in the code...
Fails to display the MessageRequester, which I'm thinking is due to it not being in scope inside the Case statement? I tried the Shared keyword which works before the Case statement but not inside.
Example 2 - Succeeds
Using the typical enumeration works just fine, and I don't have a reason I can't do that.
However, I thought dynamic IDs would be convenient and I read some stuff about preventing ID conflict, so it seemed worth trying. But it does mean replacing an enumeration with tons of variables. What's the best practice?
Code: Select all
menu_button_about = MenuItem(#PB_Any, "&About" + Chr(9) + "Shortcut")
Code: Select all
Case menu_button_about
MessageRequester("About " + #Program_Title,
"About Text", #PB_MessageRequester_Info)
Example 2 - Succeeds
Using the typical enumeration works just fine, and I don't have a reason I can't do that.
Code: Select all
MenuItem(#Menu_Button_About, "&About" + Chr(9) + "Shortcut")
Code: Select all
Case #Menu_Button_About
MessageRequester("About " + #Program_Title,
"About Text", #PB_MessageRequester_Info)