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.

Example Code

Shove-me Game

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Download All

Overview
Shove-me Game

Description:
Here's an interesting example I made last year. It can be opened using LabVIEW 7.1 and up. In "Shove_me", 4 instances of a sub-VI are opened programmatically. Each of these sub-VIs is minimized and its window is hidden so all you see is a small square of its background which is painted yellow. Each of these sub-VIs only contains an event structure to catch a mouse-move event which turns an indicator called "ouch" to TRUE
Back to "shove_me" - each "ouch" that turns TRUE triggers a move of the sub-VIs panels - so the yellow squares move. The squares appear to move as a result of the mouse shoving them around.
From this VI you can learn how to open multiple instances of a subVI, how to access its variables, how to use mouse events plus some tricks in hiding front panels of VIs and minimizing their appearance. 
A note about multiple instances of a subVI. I used a template VI (suffix .vit) which in default opens as reentrant (that you can open additional unconnected instances of the VI). Another option is to use a regular .vi, but to add an option Hex 8 to the "Open VI Reference" option node. To add a hex number, place a regular numeric constant, right click and make its radix visible, click the radix and choose Hexreentrant.bmp

Enjoy!

Instructions:

To implement this example:

  1. Run VI


To execute this example:

  1. Install the required software.
  2. Open the VI and refer the Implement Steps

 

Requirements
Software
LabVIEW 2012 or compatible

Hardware
-

2017-11-03_13-31-08.jpgbd.png

**This document has been updated to meet the current required format for the NI Code Exchange.**

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.