Quantcast
Channel: MicroStation Programming Forum - Recent Threads
Viewing all articles
Browse latest Browse all 7260

[V8i MDL] Crash when setting Multiline Text item in hook

$
0
0

This isn't a question so much as a bug report for Bentley and a gotcha for MDL programmers.

I wasted a day trying to figure out why MicroStation V8i SS4 would crash whenever I tried to set the text in a Multiline text item in the DITEM_MESSAGE_INIT hook using mdlDialog_itemSetValue().

I had copied the dialog item straight from a Tools Setting window, where the code worked fine, into a modal dialog where it refused to work at all.

I finally figured out the problem was with the resource definition. I had it defined like this:



DialogBoxRsc DIALOGID_TOOLS_EnterText =
{
DIALOGATTR_DEFAULT | DIALOGATTR_MODAL | DIALOGATTR_ALWAYSSETSTATE,
100*XC, 7.25*YC, NOHELP, MHELP, HOOKDIALOGID_TOOLS_EnterText_Dialog,
NOPARENTID, DLGTXT_EnterText,
{
{{ 7.00*XC, 8.00*YC, 0.00*XC, 0.00*YC}, MLText, MLTEXTID_TOOLS_ENTERTEXT_Instructions, ON, 0, "", ""},
}
};



The MLText displayed correctly, but would always crash at mdlDialog_itemSetValue(). The reason is that the width cannot be zero. This was hard to find because setting the width to zero caused the MLText item to nicely fit the width of the window, so it looked correct, and behaved correctly until I wanted to set the string displayed.

Hopefully this saves someone some grief.


Viewing all articles
Browse latest Browse all 7260

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>