08-15-2012 06:10 PM
hi all,
I use labview 2010 and the XTab of the Saphir toolkit. I have two questions about XTab:
thanks
Cedric
08-16-2012 06:28 AM
Hello Cedric,
I encourage you to glance at the PictureViewer.lvproj installed with ViBox - XControls toolkit. You can find it in NI Example Finder.
This project shows you how to add pages displaying the same VI. This is done using reentrant VI dynamic loading. Each page display an independant clone.
Communication between VIs displayed in XTab and your main VI can be handled by any mechanism usualy used to communicate between 2 loops. As main VI and VIs displayed in XTab could manage events I'd like to use custom user events but any other communication link (Q for example) could be used depending of your needs and your habits.
Feel free to post your project, I will look into to try to give best advice I could.
Regards,
Olivier
08-16-2012 03:38 PM
Hi Oliver,
I tried to find some solutions using the 'user event' without success. My project is in attachement. I modified the front panel of the 'PV_Main.vi' and 'PV_Dlg_ViewOnePicture.vi' to be able to pass a text from the top VI to the subVI (active XTab Page). When the button 'Send_text' is pressed, the text in the 'Results_text' control has to be sent to the 'SubVi text' of the current XTab page. any suggestions?
thank you.
Cédric
08-17-2012 10:10 AM
Hi Cedric,
I suggest a solution based on a "user event" implementation. See your project in attachment. In this solution, I've implemented a user event of String type in order to communicate a text value between the "PV_Main.vi" and the possible multiple instances of "PV_Dlg_ViewOnePicture.vi" :
In "PV_Dlg_ViewOnePicture.vi" : Creation of the string type user event and registration in the event structure. The event does simply pass the user event data value in the "SubVI_text" indicator.
In "PV_Main.vi" : The "SendText" button value change event is added. In this event, the user event reference is collected by VI server using the method "ControlValue.Get" of the active page VI reference of the Xtab and the user event is generated with the value of the "Results_text" control.
Another communication mechanism could be a "Queue communication" implementation.
Hope it will help
Matthieu
08-17-2012 10:22 AM
thank you for the solution!
what about sending data from the subVI (XTab page) to the main VI? can I do that with Event or I need to implement Q strategies?
By the way, do you think that Q would be a better solution to manage the data flow from main VI to subVI and inverselly?
thank you.
Cedric
08-17-2012 10:46 AM
hi Matthieu,
If I want to send many types of data (such a cluster of array, text and boolean, etc), a similar VI than 'PV_Gnl_DynamicallySendTextUserEvent.vi' has to be implemented. The block diagram of the 'PV_Gnl_DynamicallySendTextUserEvent.vi' is protected so maybe the use Q is better in my application. I am not completely familiar with Q, do you have some advices to pass data from the main VI to the subVI?
thank you for your help.
Cédric
08-17-2012 11:43 AM
Both solutions are possible but this is the update frequency and the data treatment duration of the data flow which you select either solution.
You could combined a user event implementation with a Q communication.
The inconvenient of the user event is that it could block the structure which receive this event if the treatment of data is too long! But you can transfer the data flow from the event structure to a parallel loop with a Queue communication for example.
Generally, I used Q communication if you have several type of data flow to transfer to the subVI. I think that implement too much user events communication is not very efficient.
I suggest you an example of managing data flow beetween the MainVI and the subVI in both directions. This example implement a Q communication for transfer data from the MainVI to subVI and a user event to transfer string text from subVI to MainVI. See it in attachment!
Normally, no VI has its block diagram locked.
Regards
Matthieu
08-17-2012 03:33 PM
thank you Matthieu, this is exactly what I wanted to do!
Cedric
08-19-2012 11:07 AM
Hi,
In order to add functionalities to my application and to develop my skills in Q strategies, I tried to create another Q communication to transfer any type of data from the SubVI to the Main VI (see attached project). To do that I modified the 'PV_Gnl_dynamicallyEnqueueAction.vi', the 'PV_Main.vi' and the 'PV_Dlg_ViewOnePicture.vi' files. Basically, when the user press the button 'Send Data Graph To IHM' located on the subVI front panel, a signal (sin wave with noise) is send to the Main VI and displayed in the Main VI graph. To do that, I created a queue in the Main VI and sent the queue ref num to the subVI when it is created. Unfortunately, it doesn’t work! Any suggestions?
Thank you
Cedric
08-19-2012 09:05 PM
Hi,
After checking my code many times, I found some mistakes. The attached code works well now!
Since I am not totally familiar with queue architecture, I implemented with my current knowledge of Labview. Do not hesitate to improve or optimize the attached project.
Thank you.
Cedric