03-06-2024 10:07 AM
Buongiorno a tutti. Ho cercato in giro qualche risposta ma non ne ho trovate, quindi scusate se ho usato male, eventualmente, la funzione di ricerca.
Avrei questa esigenza. Il mio applicativo MAIN.VI chiama una serie di altri applicativi. Ad esempio un DATABASE.VI che mi consente di visualizzare il contenuto di un database.
MAIN.VI rimane aperta sotto, DATABASE.VI ha il focus e ci lavoro dentro. DATABASE.VI a sua volta può chiamare un applicativo GRAFICI.VI che mostra un grafico delle acquisizioni relative al
record attualmente attivo in DATABASE.VI. Quando apro GRAFICI.VI, DATABASE.VI è in background e se tento di fare una qualsiasi operazione nella sua finestra non mi è consentito, a meno di chiudere GRAFICI.VI e ridare la palla al chiamante DATABASE.VI. Mi è stato chiesto di avere il controllo di DATABASE.VI o di MAIN.VI anche quando GRAFICI.VI è aperto. E' possibile farlo?
Attualmente le mie finestre sono tutte in modalità default. Per chiamare i vari VI uso una Call By Reference. Grazie del vostro aiuto e scusate l'eventuale banalità della richiesta.
Solved! Go to Solution.
03-06-2024 10:31 AM - edited 03-06-2024 10:32 AM
@zappagoblin wrote:
(TRANSLATED) Good morning everyone. I looked around for some answers but couldn't find any, so sorry if I possibly misused the search function.
I would have this need. My MAIN.VI application calls a series of other applications. For example a DATABASE.VI that allows me to view the contents of a database.
MAIN.VI remains open below, DATABASE.VI has the focus and I work in it. DATABASE.VI in turn can call an application GRAFICI.VI which shows a graph of the acquisitions relating to the
currently active record in DATABASE.VI. When I open GRAFICI.VI, DATABASE.VI is in the background and if I try to do any operation in its window I am not allowed to, unless I close GRAFICI.VI and give the ball back to the caller DATABASE.VI. I was asked to have control of DATABASE.VI or MAIN.VI even when GRAFICI.VI is open. It's possible to do it?
Currently my windows are all in default mode. To call the various VIs I use a Call By Reference. Thank you for your help and sorry for the possible banality of the request.
LabVIEW is a dataflow language and if you call an interactive VI, that part of the code will stall until the VI is complete. There are many ways to get around that and allow several interactive Vis to be open at the same time, but the details depend on the needs and we can't really tell from the sparse description. (e.g. Do they VIs return data to the caller via output terminals?)
Can you attach a simplified version of your code?
03-06-2024 10:57 AM
Thank you altenbach. I'll build a simplified version tomorrow. Thanks a lot for your indications.
03-07-2024 02:19 AM
Here I am. I wrote a very small example in which the MAIN.VI calls, upon pressing a button, DATABASE.VI which does the same with GRAFICI.VI. In MAIN.VI I inserted a Gauge, in DATABASE.VI a Knob and in GRAFICI.VI a thermometer. When the STOP keys are pressed in the VIs, they close and pass control back to the calling VI. I would like that after pressing CALL DATABASE in MAIN.VI it was possible to operate on the gauge of MAIN.VI if I bring back the focus on MAIN.VI, or that after pressing CALL GRAFICI in DATABASE.VI it was possible to operate on the Knob on DATABASE.VI. What I see, however, is that if I bring the focus back to the caller's window by clicking on its top bar, my actions seems "recorded" but not shown and take effect only when control returns to the calling VI after pressing the STOP key. I apologize in advance if I have simplified too much but I am interested in understanding the mechanism and perhaps having a suggestion on what I can study to understand and act on these mechanisms, rather than posting a complex code asking you to solve a problem that is up to me learn how to solve (with your kind help if possible). Many thanks in advance!
03-07-2024 02:56 AM
Hi zappagoblin,
@zappagoblin wrote:
I would like that after pressing CALL DATABASE in MAIN.VI it was possible to operate on the gauge of MAIN.VI if I bring back the focus on MAIN.VI, or that after pressing CALL GRAFICI in DATABASE.VI it was possible to operate on the Knob on DATABASE.VI. What I see, however, is that if I bring the focus back to the caller's window by clicking on its top bar, my actions seems "recorded" but not shown and take effect only when control returns to the calling VI after pressing the STOP key.
Your VI behaves as described by you because you programmed it this way!
THINK DATAFLOW!
When you call a subVI the caller has to wait UNTIL the subVI returns. Point.
When you want code to run in parallel then you need to call the code in parallel! As long as you call your subVI inside your event structure the event case has to wait until the subVI finishes - and so the event structure can handle other events AFTER the event case has finished!
03-07-2024 03:57 AM
Thanks for the explanations GerdW, first of all. Timeout events exist in my original code and are used, but are useless in this example. It's a typo. Call By Reference is also useless. I was interested in exemplifying the problem and I didn't pay much attention to construct the example. At this point I'll find out how to write code to run in parallel. Thanks again for the support.
03-07-2024 04:05 AM
Hi zappagoblin,
@zappagoblin wrote:
At this point I'll find out how to write code to run in parallel.
Use parallel running loops…
03-08-2024 01:14 AM
Thanks again GerdW.