LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Table cell size Problem

Dear All,

 

I am using LabVIEW 8.2.1 and I am having the problem with cell size.

 

If I enter any text in a table, I need a cell size according to the text size.

 

I used event structure, to get the active cell, but it is giving always wrong cell data. Please let me if you have any idea.

 

I am attaching example.

 

Thanks.

0 Kudos
Message 1 of 6
(2,772 Views)

I don't think Active Cell tells which cell changed.

 

I can't code up an example in lV 8.2 right now but I think I can give some pointers.

 

1) Mouse down will return the location

 

2) There is a method to convert mouse coordinates to a cell.

 

If you cache that away in a shift register, you could use that data in your event.

 

Another note!

 

On the Picture pallette there is a VI to insert text into a picture. It will return the number of pixels required to render your text measured in pixels.

 

You still have to watch out for someone tabbing through cells...

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 6
(2,755 Views)

I don't think writing in a cell makes it the active cell. What you could do is compare the old and new table value to find the row and column index of the cell that was written. Then make it the active cell and modify its width. There is probably a better way to do it but that should work.

 

Ben

 

 

Message 3 of 6
(2,751 Views)

ben64 wrote:

I don't think writing in a cell makes it the active cell. What you could do is compare the old and new table value to find the row and column index of the cell that was written. Then make it the active cell and modify its width. There is probably a better way to do it but that should work.

 

Ben

 

 


That will work but you have to be careful that both the old a new values have the same dimensions. If a new row or collumn is added, the simple "Compare if Not Equal" will only compare the parts that have the same dimensions.

 

But if done correctly YES that will work.

 

Ben

 

(The other Ben)

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 6
(2,746 Views)

Ben,

 

Thank you for your information. But exactly I am having the problem, if both are not in (Old and NEW) same size.

 

Is there any way to simplify the program. 

 

0 Kudos
Message 5 of 6
(2,718 Views)

Since you would end up scanning the entire table anyway to find a changed value, why not autosize the entire table whenever a value is changed.  Here is a quick example.  I was lazy and just set the size to 7*length, you could tweak to get a reliable text length to width conversion.

 

TableSize.png

 

I haven't patched LV2009 yet so trying to save for LV8.2 is going to either crash my LV or require too many steps for me right now.  I think you get the idea.

Message 6 of 6
(2,702 Views)