I'm attempting to instantiate a OptionButtonSubItem object, but I can figure it out - What I'm doing will compile/link but it crashes MicroStation:
OptionButtonSubItem subItem = OptionButtonSubItem(); // this isn't correct either // OptionButtonSubItem subItem();
Bruce Reeves SRNS said:// this isn't correct either
That's an example of the C++ most vexing parse. You've declared a function subItem that takes no argument and returns an OptionButtonSubItem. We've all done it!
subItem
OptionButtonSubItem
How about simply...
OptionButtonSubItem subItem;
Regards, Jon Summers LA Solutions
Nope... That crashes CONNECT as well.....
Bruce Reeves SRNS said:Nope... That crashes CONNECT as well.....
Crashed when you tried doing what with the OptionButtonSubItem? You haven't shown how you've set up the values for the item either...
Hi Bruce Reeves SRNS,
FYI. Development is taking a closer look at this and we will try to provide a code snip or determine if any enhancements may be needed to add to the public API/SDK. I will provide any feedback as soon as I receive it.
Thank you,Bob
It's now almost March 2020 (CONNECT U13.1) and I've tried to use OptionButtonSubItem again - it still crashes.
DialogItemP pickListDiP = mdlDialog_itemGetByTypeAndId(dbP, RTYPE_OptionButton, OPTIONBUTTONID_Amendment, 0); if (pickListDiP) { OptionButtonP optBtn = pickListDiP->GetTypePtr<OptionButtonP>(RTYPE_OptionButton); for each (PermitDataType data in foundPermits) { OptionButtonSubItem subItem; // Usage causes crash //... } }
Can you test something like this in your code to see if this helps?
bool enabled; OptionButtonSubItemP subItem = optnBtn->GetSubItem (itemValue.GetLong()); if (NULL != subItem) enabled = subItem->IsEnabled();
My attempt to use OptionButtonSubItem is to "create/insert" a sub-item into the OptionButton, so there is no current SubItem entry to "get".