Example Code

Position Front Panel with Mouse Drag Using LabVIEW

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

Overview

This example shows how to drag frontpanel by using mouse events with LabVIEW.

 

Description

This is a VI I have used a few times when I want to hide the normal bar at the top of a window, but still, want the user to be able to move the window around.  I either have my own bar at the top (made from some control) or just want to let the user click and drag anywhere on the Front Panel to move it around. Position FP on Mouse Down.vi is to be used in a Mouse Down event and will reposition the calling VI's front panel for as long as the user holds down the left mouse button.

The Mouse Down event in the Example.vi is for the Pane, so you can click and drag anywhere on the Front Panel to move it around.  As mentioned above, you can add any control and use the Mouse Down event for that control.

 

Requirements

Software:

  • LabVIEW 2012 (or compatible) 

 

Steps to Implement or Execute Code

1. Run VI.
2. Click, hold, and drag anywhere on the Front Panel.

 

Additional Information or References

 

2012.PNG

 

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

 

  

 

Brian A.
National Instruments
Applications Engineer

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

Comments
Balaji_DP
Active Participant
Active Participant
on

can you send me this file with labview 8.6 version....?

Regards,
Balaji DP
Balaji_DP
Active Participant
Active Participant
on

if i use this vi, it can be change in position only. but can i able to resize the panel....even if i hide my tittle bar?

Regards,
Balaji DP
Brinoceros
NI Employee (retired)
on

I saved an 8.6 version and added it.  You can still rezise the window without the title bar.  All of these settings are in File >> VI Properties >> Window Appearance >> Customize...  I recommend just playing around with them to see what they do.

Another note: If you don't need the mouse reference wire for anything else (like in the example) you can just put the open/close for the mouse inside of positionFPonMouseDown.vi.  It's probably a little less efficient but it cleans things up a bit and behaves the same.

Brian A.
National Instruments
Applications Engineer
Balaji_DP
Active Participant
Active Participant
on

Thanks Brinoceros,

                                  this is will be very helpfull for my project.

Regards,
Balaji DP