Jump to content

Message Display Table


Rammer

Recommended Posts

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

Link to comment
  • 4 weeks later...

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

Link to comment

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.

Link to comment

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

Link to comment

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

Link to comment

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.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.