KoBe Posted September 27, 2011 Report Share Posted September 27, 2011 Hi people, i have quite a big project and therefore I would like to make the block diagram of my MainVI more readable. There are several parallel task packed in SubVI's, which looks really pretty. The last challenge for me is the Event Structure of the MainVI. With this Event Structure I react on user input on the MainVI Controls and Indicators. At the moment I haven't implemented any User Events. Now I'm searching for a possibility to move the Event Structure of the MainVI in a SubVI to make it also more compact. Is the a possibility to do that? In fact this would mean, a SubVI must be able to handle Events fired by it's MainVI. Can anyone help me please? Thanks in advance! Quote Link to comment
asbo Posted September 27, 2011 Report Share Posted September 27, 2011 You can wire control references into a Register For Events node to create a dynamic event refnum that can be passed into a subVI. Once in the subVI, perform the registration for your dynamic event refnum. In general, though, it's best to leave a UI-related event structure in the VI it responds to. 1 Quote Link to comment
Grampa_of_Oliva_n_Eden Posted September 27, 2011 Report Share Posted September 27, 2011 You can wire control references into a Register For Events node to create a dynamic event refnum that can be passed into a subVI. In general, though, it's best to leave a UI-related event structure in the VI it responds to. Well I never learned that leason so being the fool that I am I went off and started pushing evnts down into the sub-VI that handle each of the modes the app runs in. I will not multiply words but I will invite you to examine the images I uploaded to the Dark-side that can be found here. This approach lets me develop sub-VI that are clean and focused on only the events that apply to the current operating mode as shown here. If you really want to rad more about this approach see this thread on the Dark-side. Ben 2 Quote Link to comment
asbo Posted September 27, 2011 Report Share Posted September 27, 2011 Thanks for being the exception to the rule, Ben. 1 Quote Link to comment
jgcode Posted September 27, 2011 Report Share Posted September 27, 2011 ...the sub-VI that handle each of the modes the app runs in. Another example includes making skinable UIs - if you want to have two different UI themes or resolutions etc... The UIs should be thin (to avoid redundancy) and you have an engine VI to handle events. I have made a thin UI before so as to disassociate the UI from engine. Its more work but can be beneficial. Quote Link to comment
Val Brown Posted September 28, 2011 Report Share Posted September 28, 2011 Now that kind of skinnable, thim UI sounds very interesting. Any examples you can post? Quote Link to comment
KoBe Posted September 28, 2011 Author Report Share Posted September 28, 2011 You can wire control references into a Register For Events node to create a dynamic event refnum that can be passed into a subVI. This short instruction answers already all my questions. Thank you! Well I never learned that leason so being the fool that I am I went off and started pushing evnts down into the sub-VI that handle each of the modes the app runs in. I will not multiply words but I will invite you to examine the images I uploaded to the Dark-side that can be found here. This approach lets me develop sub-VI that are clean and focused on only the events that apply to the current operating mode as shown here. Your picture made me understand the short instruction from asbo. Thanks you! Quote Link to comment
jgcode Posted September 28, 2011 Report Share Posted September 28, 2011 Now that kind of skinnable, thim UI sounds very interesting. Any examples you can post? On the road, so don't have any examples with me however, the JKI Module presentation shows how you can 'fit' a UI onto another module and the old LabVIEW Advanced course showed two examples (Event Structure and Queues) for doing this - if you can get your hands on that book it is a good read. Cheers! Quote Link to comment
mje Posted September 28, 2011 Report Share Posted September 28, 2011 Well I never learned that leason so being the fool that I am I went off and started pushing evnts down into the sub-VI that handle each of the modes the app runs in. I will not multiply words but I will invite you to examine the images I uploaded to the Dark-side that can be found here. This approach lets me develop sub-VI that are clean and focused on only the events that apply to the current operating mode as shown here. Indeed, I do the same. My only real rule is to "never" pass event registration refnums to subVIs due to the static typing. The event registration always stays in the VI that has the event structure using the registration, but I impose no restriction on where these are relative to the actual event source(s). 1 Quote Link to comment
asbo Posted September 28, 2011 Report Share Posted September 28, 2011 Indeed, I do the same. My only real rule is to "never" pass event registration refnums to subVIs due to the static typing. The event registration always stays in the VI that has the event structure using the registration, but I impose no restriction on where these are relative to the actual event source(s). This is a good explanation of what my prescribed "best practice" is really looking to prevent. I fully support using GUI controllers as long as event refnums aren't being created and destroyed at different levels of the architecture (I updated my first post to not encourage this). Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.