twk 234 Posted January 13 (edited) vs.GetLBHeaderTextWidth(className, allowForSortIcon) The function above is crashing my VW 2021. Anyone else can confirm before I try a reinstall/bug submission? It gets pixel width for specified string (param:className for some reason??) for use with Dialog ListBrowsers.. Cheers, Tui Edited January 13 by twk Quote Share this post Link to post
JBenghiat 334 Posted January 13 Generally: - VectorScript should never crash the application, even when used improperly, so always report a bug - Unless you modified the application folder (which you shouldn’t do), re-installing the same version won’t resolve any issues. Creating a new user folder can resolve some issues, though. The only thing to check is that you’re passing in a valid string. I believe this command also predates Unicode support, so check that you’re not using any special characters. Quote Share this post Link to post
twk 234 Posted January 13 Yep, all simple strings in my testing, I shall submit a bug. Do you use ListBrowsers in your plugins @JBenghiat? Have you ported to 2021 yet? All my plugins work and the only ones crashing were the ones with this function in them. Commenting it out solved the issue, but there wasn't anyother way for me to get a proper width value for setting column widths from text strings. I've had to resort to hard coding guessed string lengths for now. Quote Share this post Link to post
JBenghiat 334 Posted January 14 I don't use the function — I set column widths based on expected data and the overall width of the dialog. That said, this command doesn't actually rely on list browsers, other than that the pixels are probably calculated based on the LB fonts. Running this command as a standalone script works just fine, so something else might be at play. (SP2) val = vs.GetLBHeaderTextWidth('Some Text', False) vs.Message(val) Quote Share this post Link to post
twk 234 Posted January 14 Interesting, crashes on me every time, even as a standalone script as you've shown. Are you on Mac? It must be a Windows specific thing. Quote Share this post Link to post
JBenghiat 334 Posted January 14 Yes, I'm on the Mac. It could very well be OS specific, even graphics card driver specific, as VW is retrieving the number of display pixels for the string. Quote Share this post Link to post
_c_ 814 Posted January 15 Ciao @twk, you got me curious, I can confirm that GetLBHeaderTextWidth doesn't crash on Mac under VW 2021. I have no access to win at the moment. 1 Quote Share this post Link to post
tbexon 7 Posted Tuesday at 12:29 PM (edited) val = vs.GetLBHeaderTextWidth('Some Text', False) vs.Message(val) I just tried this on win10 in VW 2021 SP2 (574483) 64 bit and it crashed my VW straight away. Edited Tuesday at 12:30 PM by tbexon Quote Share this post Link to post
_c_ 814 Posted Tuesday at 12:45 PM @twk I added a remark on dev, it is important for people to know it. https://developer.vectorworks.net/index.php/VS:GetLBHeaderTextWidth Is it you the user Tui? I credited to that user. 1 Quote Share this post Link to post
twk 234 Posted Tuesday at 02:26 PM Ahh yes, that would be me, I forgot I had even signed up as a contributor. Quote Share this post Link to post