One of the benefits of MDL dialog boxes is that we can re-use dialog items. That is, one can define a dialog item once and use it many times, in one or more dialog item lists.
This re-use idiom extends to MicroStation dialog items. We can incorporate an MDL dialog item into our own container simply by citing its item ID (usually found in /Mstn/MdlApi/dlogids.r.h). Here's an example...
/Mstn/MdlApi/dlogids.r.h
CmdItemListRsc ItemList_Example = {{ {{ 7*XC, GENY(10), 12*XC, 0}, OptionButton, OPTIONBUTTONID_SolidSurface, ON, 0, "", ""}, }};
Where number OPTIONBUTTONID_SolidSurface is defined in dlogids.r.h. But OPTIONBUTTONID_SolidSurface is not the dialog item I want to re-use.
OPTIONBUTTONID_SolidSurface
dlogids.r.h
The option button I want to include in my own dialog is Locate Interiors, which you will find in MicroStation's User Preferences dialog.
However, I can't find the item ID of that option button. Its access string, I believe, is userPrefsP->smartGeomFlags.locateSurfaces.
userPrefsP->smartGeomFlags.locateSurfaces
It is an unpublished item id. Its number is -4225. I don't know if it can be directly used in our own dialog.
Yongan.Fu said:It is an unpublished item id. Its number is -4225
Thanks! Can the header file that contains that definition be made public? Is there any reason why it is not public?
It's not hard to write the equivalent resource — but why should we since it already exists?
#define OPTIONBUTTONID_LocateInteriors 1
/*----------------------------------------------------------------------+ | | | Option Button Interior Locator Refer to LOCATE_SURFACES_ defines | | | +----------------------------------------------------------------------*/ DItem_OptionButtonRsc OPTIONBUTTONID_LocateInteriors = { NOSYNONYM, NOHELP, LHELPCMD, NOHOOK, NOARG, TXT_LocateInteriorsPrompt, "userPrefsP->smartGeomFlags.locateSurfaces", { {NOTYPE, NOICON, NOCMD, MCMD, LocateSurfacesPref::Never, NOMASK, ON, TXT_oBtnNever }, {NOTYPE, NOICON, NOCMD, MCMD, LocateSurfacesPref::ByView, NOMASK, ON, TXT_oBtnByView }, {NOTYPE, NOICON, NOCMD, MCMD, LocateSurfacesPref::Always, NOMASK, ON, TXT_oBtnAlways }, } };
Regards, Jon Summers LA Solutions
Answer Verified By: Jon Summers
Jon Summers said:It's not hard to write the equivalent resource — but why should we since it already exists?
This internal item doesn't use userPrefsP->smartGeomFlags.locateSurfaces as its accessing string, instead, it uses its own access string. Maybe this is the reason.
Yongan.Fu said:This internal item doesn't use userPrefsP->smartGeomFlags.locateSurfaces as its accessing string
Well, that is a surprise! The behaviour of my option button does exactly what the user wants, so are those variables linked internally somehow?
Happy New Year!
Hi Jon Summers (and Yongan.Fu),
FYI and FWIW...It is common to provide a public CExpression Access string (like: userPrefsP->...) for dialog items that often use an application specific SynonymID to synchronize internal access strings with their public CExpressions.
One other MicroStation CONNECT GUI/UI note/consideration while moving forward would be...
Prefer using .ICO icons vs. .R icon definitions in your applications (especially mono and/or gray scale) since they will be easier to modify and tune appearances for use with MicroStation's recent (TechPreview in MSCE U15) Dark Theme Mode.
HTH and Happy New Year,Bob
Robert Hook said:One other MicroStation CONNECT GUI/UI note/consideration while moving forward would be... Prefer using .ICO icons vs. .R icon definitions in your applications (especially mono and/or gray scale) since they will be easier to modify and tune appearances for use with MicroStation's recent (TechPreview in MSCE U15) Dark Theme Mode.
A great hint but I think it deserves its own topic or even wiki article.