Jump to content

Rotated table column headers > .NET picture control


Recommended Posts

I ran into a situation where I really needed a rotated column header for a table due to having long column header names and not enough space.

After doing a bunch of looking around, it didn't really seem like this capability existed anywhere for LabVIEW, so I'm sharing a little piece of code that I created for this here.

LabVIEW doesn't natively support rotated strings, so that wasn't an option.
LabVIEW 2D picture controls would theoretically let you write, and then rotate text.  But LabVIEW 2D picture controls don't support aliasing, so I didn't perceive this to be an option.
@hooovahh recently posted a fun .NET picture control library to VIPM, and that inspired me to go down the .NET picture control rabbit hole.
Having to deal with opening and closing all the .NET references is a bit of a hassle, but I'm surprised by how much capability exists with the .NET picture control.  High complexity ceiling.
Looking back, I wonder if I should have tried the LabVIEW 3D picture control instead.

Anyways, this demo provides the following capability:
- rotated column headers by specified angle
- anti-aliased text
- column headers size to table column width/positions

image.png.d6e8cc8fbf555a2aa207c1f7a98b8b10.png

RotatedColumnHeader.zip

  • Like 2
Link to comment

Love it, thanks for the shoutout.  There is plenty of room for improvement if you ever want to make this into a more polished API.  I could see it reading the column width information, and working with the resizing of them.  Thanks for sharing, I know I've seen a few requests for things like this in the past.

  • Like 1
Link to comment

Thanks Hooovahh!

I don't have time to turn this into a polished Qcontrol or anything like that at the moment.

However, I did make a small improvement to the code:
You can now use the horizontal and vertical table scrollbars, and the rotated header will update accordingly.

related note: I discovered that ActiveCellPosLeft will return a 0 if the active cell is not visible.  That's so lame.
Fortunately, it's still possible to calculate offscreen CellPos by reading cell width (which apparently still works for offscreen cells), and then doing math from the nearest visible cell's position.

image.png.7df1e53987de807a25c65ccce2affa6b.png

RotatedColumnHeader_scrollbar.zip

  • Like 2
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.