LabVIEW APIs Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

How to set the size of a string constant

Does anybody know how to set the size of a string constant?

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 1 of 7
(4,213 Views)

Are you refering to the number of characters the string contains or the size the constant takes on the screen?

For the first there is a private property Preallocated Length, the second I do not think there is any way to do it.

Rolf Kalbermatter

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 7
(3,272 Views)

It's the latter, I am trying to shrink a long string constant to pre-defined size.

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 3 of 7
(3,272 Views)

Hi Ton, I just remembered a VI from some time ago that can be found here. It is meant for Controls really but since it seems to access the LabVIEW GObject methods there is a good chance that it can work for constants too.

Rolf Kalbermatter

Rolf Kalbermatter
My Blog
0 Kudos
Message 4 of 7
(3,272 Views)

Thanks Rolf,

too bad it doesn't work:

Error53.png

Somewhere deep in LabVIEW a manager is in place and he is not supported.

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 5 of 7
(3,272 Views)

A well, it was worth a try but I have to admit I'm positively surprised this returns an error and not just crashes . As far as I know it does call LabVIEW internal C functions. They might be checking specifically for a certain type of object class such as all types of Front panel controls, not accounting for the possibility of diagram constants, which problably would work too, as I would assume their object method table to be similar to the FP controls, for these basic object operations.

Rolf Kalbermatter

Rolf Kalbermatter
My Blog
0 Kudos
Message 6 of 7
(3,272 Views)

There is always the standard hack method of resizing anything (I used it for growable nodes fairly extensively, and still do for some of them).

  1. Read the old size (Bounds property) from the current item.
  2. Read the location from the current property.
  3. Modify the bounds to what you would like.
  4. Create a new object in the same location as the old one, but with the new size.
  5. Connect all wires from the old to the new.
  6. Copy any properties you care about from the old to the new (e.g. value).
  7. Delete the old item.

Yes, this is a horrible hack, but it will get you there until we fill all the holes in the UI.  Thanks for finding another one!

I have submitted CAR 186942 for this issue.

0 Kudos
Message 7 of 7
(3,272 Views)