Jump to content

Removing a column from a Tree Control


mje

Recommended Posts

I have a tree control in one of my user interfaces which I just removed a column from. The problem now is that I can't seem to convince LabVIEW that I actually don't want that column. My tree always has an empty column at the right, and the scrollbar always sizes for this column:

post-11742-0-25754700-1305566664_thumb.p

Surely there's some way of convincing the IDE I actually don't want that column? Short of replacing the control and reconfiguring a new one (hoping I don't break anything in the process), I can't think of any other way...

Link to comment

I'm sure this isn't what you are asking, since that would be too simple, but maybe it will help someone:

In the Tree Properties dialog (I'm looking at the System version) on the Appearance tab there are ring controls to set the number of Rows and Columns, as well as set the properties of the scroll bars.

Presumably the control is no longer in a state where you can do this?

Link to comment

I can indeed do as much, but that only appears to modify the number of visible rows by resizing the tree. The scrollbars still size to the contents of the "old" columns, so the user will always be able to scroll out to the blank column. The best I can do is size the empty column to a few pixels wide.

Unfortunately it's looking like I have to delete and recreate the control. Unfortunately this might introduce defects if I forget to set the new control's properties exactly the same as the original, so I've been holding off on doing that.

Yet another "I hate LabVIEW UI elements" vote...

Link to comment
  • 4 years later...

I doubt that recreating the control helped mje but perhaps he will let us know. In my experience, using the well-know scientific trial & error methodology, the number of columns in a tree is to a large extent dependent on how many are visible in the GUI. If you delete a column you need to resize the remaining columns to fit in the control or reduce the control width, making sure that your last wanted column boundary is just hidden beneath the control border. Then adjust the number of columns property.

 

Be warned: if you later drag the right-hand border of the control to enlarge the real estate you will magically get that pesky extra column again - the number of columns property will increase by however many columns you expose!

 

It seems to me that a better behaviour would be to just make the extra space to the right the number of columns dead, and never alter the number of columns until the user explicitly sets it.

Link to comment

A lot has changed in 4 years but this still seems to be the normal behavior of a tree control.  At some point the multicolumn listbox was improved to actually realize when a column was deleted by right clicking, and adjust horizontal scrollbar size accordingly.  But there isn't a similar option for a tree control.

 

Replacing the control does indeed convince LabVIEW the number of columns are different, and that is how I've always handled this situation.  One step that might help make this process easier is you can replace a control in LabVIEW, with one in your clipboard, and have all the references, and events on that control go to the new one.  I tested this and it does behave as you'd expect in terms of the number of columns.  I created a tree with a string in columns 3 and 4, then deleted the string in column 4 and saw that the size according to the visible scrollbar still shows column 4 in the size.  I then created a new tree, copied it to the clipboard, selected the old tree and pasted, which replaced the old one with the new one.  Changing the column width to 1 pixel can work as well.

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.