LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error 1148 of OpenG Fit to Largest Decoration when calling SubVI using SubPanels

Solved!
Go to solution

Hi all,

 

my MainVi calls a SubVi in its Subpanel, running the SubVi before inserting into the SP. I used the OpenG Fit to Largest Decoration to fit the SubVi nicely into the Subpanel (Thanks to Bob Schor for that tip). However the error 1148 occurs. When I run the SubVi on its own the error does not occur. The only workaround I found so far was to clear the specific error but it'd be nice to eliminate it totally.

 

Attached are extremely stripped down versions of the real programme. To save everyone's time and effort, please no unrelated, tangential comments of 'why don't you change the mechanical action of stop buttons' unless it's the cause of the error... 

 

Thanks!

0 Kudos
Message 1 of 7
(3,383 Views)
Solution
Accepted by topic author nikvl

The error says "This property is read only while the VI is in a subpanel." So you need to run the "Fit VI window to Largest Decoration" VI before inserting into a subpanel. Either in your subVI, run "Fit VI window to Largest Decoration" and then insert itself into the subpanel (my preferred method because then it can ensure it's done any necessary UI initialization before being shown to the user) or in the main VI, call "Fit VI window to Largest Decoration" on the subVI reference and then insert it into the subpanel (as you are doing now).

Message 2 of 7
(3,370 Views)

I keep that VI locked away in a disabled structure, to be enabled when needed.  No need to run it every time, only when setting the initial size of the FP, or - ahem - if you screw up the size by accidentally resizing the FP.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 3 of 7
(3,313 Views)

What I do for VIs that will be subpaneled (if I'm not making things resizeable, anyway) is set the minimum panel size to be the same size as the subpanel it will be put in. Then if I resize the front panel later while I'm working on something, I can easily resize it back to the proper size just by making it as small as it will go. And I use the set all panes to origin as ctl+o quickdrop shortcut to make sure the origin is 0,0.

Message 4 of 7
(3,308 Views)

My current Project is a Producer/Consumer, where the Producer handles high-level stuff and the Consumer "does all the work" (isn't that always the case!).  Anyway, the Consumer runs fairly slowly, every few seconds getting a data point to plot on a graph.  On the Main (Producer) routine, it sits on the Block Diagram waiting to be called.  It is important that its Front Panel be closed when it is called, otherwise it generates an Error (which I thought was 1148 -- I haven't seen it in a while).  My Producer initializes with the following sequence:

  1. It does its own "Fit to Largest Decoration" to look "neat" on the PC's Monitor.  The Sub-Panel has been sized to match the Decoration on the Consumer.
  2. It makes sure that the Consumer is closed.
  3. It inserts the Consumer (by means of a Static VI Reference) into the Sub-Panel.
  4. It starts the Consumer.

This works in Development Mode.  It works equally well when built into an Executable (with just the Main listed as the Startup VI -- it pulls everything else needed into the Application).

 

Here's a picture of the Consumer -- note the Fit to Largest Decoration is simply one of the first things to happen when this VI starts (which happens, as shown above, after it is placed in the sub-Panel).

Consumer in sub-PanelConsumer in sub-Panel

Bob Schor

0 Kudos
Message 5 of 7
(3,277 Views)

@Bob_Schor wrote:

My current Project is a Producer/Consumer, where the Producer handles high-level stuff and the Consumer "does all the work" (isn't that always the case!).  Anyway, the Consumer runs fairly slowly, every few seconds getting a data point to plot on a graph.  On the Main (Producer) routine, it sits on the Block Diagram waiting to be called.  It is important that its Front Panel be closed when it is called, otherwise it generates an Error (which I thought was 1148 -- I haven't seen it in a while).  My Producer initializes with the following sequence:

  1. It does its own "Fit to Largest Decoration" to look "neat" on the PC's Monitor.  The Sub-Panel has been sized to match the Decoration on the Consumer.
  2. It makes sure that the Consumer is closed.
  3. It inserts the Consumer (by means of a Static VI Reference) into the Sub-Panel.
  4. It starts the Consumer.

This works in Development Mode.  It works equally well when built into an Executable (with just the Main listed as the Startup VI -- it pulls everything else needed into the Application).

 

Here's a picture of the Consumer -- note the Fit to Largest Decoration is simply one of the first things to happen when this VI starts (which happens, as shown above, after it is placed in the sub-Panel).

Consumer in sub-PanelConsumer in sub-Panel

Bob Schor


I don't quite understand. From your description, is the Producer/Consumer loop a separate SubVi or is everything in one Vi? I have tried using Static VI References along with Run Vi but I couldn't make it work because the controls of the SubVi in the Subpanel would not respond (there's a separate thread on that altogether) 

 

Als, based on your reply here https://forums.ni.com/t5/LabVIEW/How-to-get-Sub-Panel-to-center-on-VI-it-is-showcasing/td-p/3679968, I placed the start aynchronous call before the Insert Vi but otherwise it's not absolutely imperative for me to do that.

0 Kudos
Message 6 of 7
(3,259 Views)

What I posted is a sub-VI that is the Consumer Loop.  Here's part of the Main, showing the Initial State which (as it exits) calls the next State that starts the Consumer (it's called "See Consumer" because the Consumer becomes "visible" in the sub-Panel in this State just before it is sent its Init Consumer Message.  I've used detached routines in sub-Panels (started by Start Asynchronous Call), but it's just as easy to just call them to start them running (but you do want them to run in a Parallel Loop, as they do here -- note that the "Pipes" coming in to the Consumer is an Asynchronous Channel Wire, specifically a Messenger Channel, so this Loop runs in parallel with the Message Handler Loop shown in the picture below).

Part of Producer of Producer/Consumer DesignPart of Producer of Producer/Consumer DesignBob Schor 

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