Rammer Posted October 2, 2009 Report Share Posted October 2, 2009 Developers, I am trying to come up with a good way to display messages from an application similar to the Event Log in windows. Using a multi-column list box I can map a symbol to a bitmap of the error, warning and informational images. However, the problem I have is if I have a long message the cells do not automatically word wrap. Has anyone dealt with this? We could automatically word wrap in an Xcontrol but this seems like something that a GUI component like this should support automatically. Anyone try something like this? John Quote Link to comment
zythum Posted October 30, 2009 Report Share Posted October 30, 2009 Developers, I am trying to come up with a good way to display messages from an application similar to the Event Log in windows. Using a multi-column list box I can map a symbol to a bitmap of the error, warning and informational images. However, the problem I have is if I have a long message the cells do not automatically word wrap. Has anyone dealt with this? We could automatically word wrap in an Xcontrol but this seems like something that a GUI component like this should support automatically. Anyone try something like this? John If you use a font where are caracter have the same spacing (like courier), you can determinate how many char into one line. Using the space before n char and replace space by \n Quote Link to comment
hooovahh Posted October 30, 2009 Report Share Posted October 30, 2009 I've found a little gem that I've never really had a need for called "Longest Line Length in Pixels". Basically it tells you the width of a string control/indicator based on its font, and font size. It's located in the vi.lib in at least version 8.2. LabVIEW XX\vi.lib\Utility\error.llb\Longest Line Length in Pixels.vi With this you could tell if your length is too long, then remove a word from the end of the line and put it on the next line until it fits your width. Quote Link to comment
Popular Post bmoyer Posted October 30, 2009 Popular Post Report Share Posted October 30, 2009 Here's what I use. You feed in the string to word wrap and how it is formatted (font, size, etc.) and it returns the string with line breaks. Bruce Word Wrapping.vi Word Wrapping (Entire Column).vi 6 Quote Link to comment
ShaunR Posted October 30, 2009 Report Share Posted October 30, 2009 Here's what I use. You feed in the string to word wrap and how it is formatted (font, size, etc.) and it returns the string with line breaks. Bruce Sweet Quote Link to comment
hooovahh Posted October 30, 2009 Report Share Posted October 30, 2009 Here's what I use. You feed in the string to word wrap and how it is formatted (font, size, etc.) and it returns the string with line breaks. Bruce Wow this is nice. I hope you don't mind (I'm not trying to one up you), but I've modified your code to work with control references. So all you need to do is pass it a reference to your string, and the width you want it to be. You don't need to input the font size and type. Word Wrapping Hooovahh edit.vi Example Hooovahh Edit.vi Quote Link to comment
bmoyer Posted October 30, 2009 Report Share Posted October 30, 2009 Wow this is nice. I hope you don't mind (I'm not trying to one up you), but I've modified your code to work with control references. So all you need to do is pass it a reference to your string, and the width you want it to be. You don't need to input the font size and type. Hmmm, I see some advantages to using references, but I'm not sure how you use this to get a multi-column listbox to word wrap. How do you get the reference to a particular cell? Bruce Quote Link to comment
ShaunR Posted October 30, 2009 Report Share Posted October 30, 2009 Hmmm, I see some advantages to using references, but I'm not sure how you use this to get a multi-column listbox to word wrap. How do you get the reference to a particular cell? Bruce You would have to coerce the refnum to a more specific class to make the properties for that type available. Quote Link to comment
crelf Posted October 30, 2009 Report Share Posted October 30, 2009 Here's what I use. You feed in the string to word wrap and how it is formatted (font, size, etc.) and it returns the string with line breaks. Nice! Time to lay on some kudos Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.