From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to resize a constant programmatically

Solved!
Go to solution

Hello all Labviewers,

 

I am currently developping a VI which should get 4 coordinates (x, y, height, width), and a VI path. With these informations should this VI create a flat frame into the block diagram of the VI given as parameter.

 

I succeeded to create it, but I have no explanation why the bounds are staying fix...

 

In Labview help for "New VI Object Funtion", you can read the following :

 

"bounds specifies the width and the height of the new object if the new object is resizable. Labview ignore bounds for fixed-sized objects."

 

But a flat frame should not be a fixed-sized object, or?

 

What is surprising, is that I succeed to create in the front panel a flat frame with the wanted size...

 

You can see under a screenshot of the code... I hope someone can find an answer to this problem 🙂

 

Code.png

Thanks a lot in advance,

 

Arnaud

 

 

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

Attach your VI so we can play with it.

0 Kudos
Message 2 of 6
(2,926 Views)

Hi RavenFans,

 

Here it is.

 

Thanks for considering my problem 🙂

0 Kudos
Message 3 of 6
(2,923 Views)
Solution
Accepted by topic author arnaudTT

A flat frame is definitely not fixed size.

 

I had to do a couple things to make your VI work.

1.  Create a VI of any given file name and save it.

2.  Make sure that VI is actually open before running your VI.

3.  I had to wire the error wire so that the Master Rectangle node was guaranteed to execute before you close the VI reference.  Otherwise there is an error.

4.  Right now the Master rectangle node isn't doing anything.  I wired an indicator to it.

 

Once the flat frame was created, I was able to easily change the size of the decoration by dragging the borders.

 

I wasn't able to use the Master Rectangle node to programmatically set the size and location.  But turning on the context help for that node showed it is a read-only property.

 

If you want to change the size or position of that decoration, use the Size and/or Position property nodes which are normal (not scripting) properties.

0 Kudos
Message 4 of 6
(2,912 Views)

Ooooooh, how stupid I am!!!!

 

Thanks a lot, I didn't see this "Size" property... And it's not a problem if the VI for me if the VI has to be opened.

 

 


Perfect, problem solved 🙂

 

 

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

In general, anything which you can resize manually on the block diagram you can resize programmatically using scripting. However, finding the right property can be "fun," since the reason for this behavior is that many things can change the size of a control, depending upon what control it is. The read-only sizes are a constant for all controls.

0 Kudos
Message 6 of 6
(2,851 Views)