LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

graphical user interface (GUI)

The stop button has nothing to do with an event structure. I made the subVI a dialog VI. It's set from VI Properties>Window Appearance. Clcik the customize button to see what gets changed when you select Dialog.

You can't just rename an event. If you add another control, you can associate an event with that control. Just click on the event structure and select 'Add Event Case'. You can then select the control and the event you want.

A subVI does not have to have inputs or outputs. The purpose of the example was just to show you the basic idea of a subVI that created a folder. In pratical use, you would probably want to pass the newly created folder back to the main VI.

I'm not sure what to say about your posted VI. It really doesn't do anything. The OK button is not wired to anything and the value is ignored. The Write to LabVIEW Measurement function would create an empty file since you have nothing wired to the signals input. It would just do this over and over again until you press the stop button. There's no event structure in here. I'm not sure where your confusion is between an event structure and a case statement. An event structure handles front panel events such as mouse down, value change, etc. The event structure is idle until one of those events happens. The case statement can do some of the same things. For example, you could have a front panel Boolean wired to a case statement. When the Boolean goes true, the code inside the true case gets executed. The difference is that LabVIEW will constantly read the status of the front panel Boolean. This is called polling. This is a bit more inefficient than the Boolean firing an event and then LabVIEW will respond to the event. Events use less computer resources.
Message 11 of 18
(1,960 Views)
Here is a tutorial from NI-Week 2004 on generic GUI creation.  It was written in LV 7.1, but you can easily put things into a project to make it easier.  It includes using the event structure.
0 Kudos
Message 12 of 18
(1,949 Views)
still dont know much about making GUI since this is really my first time (even on labview). and the VI that i uploaded was just its basic on how to write the text file.

although am getting better on how to use the event structure. 😃

how to get a the path from  another path (let's say a path was already made for a folder, and then that path is again needed for the text file inorder for the text file to be under the new folder created)?
 
the reason that i didn't connect any output to the "write to labview measurement" yet is because the input (comes from an outside source and is still not determined). am just trying to make a GUI that can create name, and files.

btw, does the function in playing a music in labview only uses files that have extensions of .wmv? can it use other sound formats like .mp3?


0 Kudos
Message 13 of 18
(1,927 Views)
To create a path from a directory, use Build Path, found in the File I/O palette.

A quick GUI for file names can be made several ways.  If you are using an event structure to create a file query dialog, just use the File Dialog, found in the Advanced File Functions palette.  For front panels, use the path control, found in the String & Path palette.  It has a button that launches a file dialog.

Unfortunately, LabVIEW sound functions cannot play MP3 files.  MP3 is a licensed format, so is not supported natively.  However, if you do a search on this forum for "play mp3",  you will find several ways to do it, depending on your platform.

Good luck and keep on wiring...
Message 14 of 18
(1,910 Views)
i've already used the build path, but how do make make it real time.

the flow of the program is like this: the main vi calls for the subvi(1) that creates a new folder will be created (c:\ my documents\compile), and subvi(2) that creates the data within the folder (c:\my documents\compile\data). i used event structure for this, and their events are: 0 timeout, 1 new folder, 2 data, 3 stop.

my problem now is how do i get the path name of the new folder (event 1) and connect it to the build path of the data (event 2). or should i just place there the function from the string and path palette and ask for an input as to where the file will be stored?


0 Kudos
Message 15 of 18
(1,897 Views)
You return the path from the subVI that creates it and pass it to the event that creates the data file with a shift register. Here's a modifed version of the main and subVI that I sent earlier. Shift registers are basic functions in LabVIEW and you need to learn how to use them.
Message 16 of 18
(1,886 Views)
You can also accomplish this using the shift register databases mentioned in the tutorial I posted above.  For your case, the database data could consist of a path and a filename.  When event 1 fires, it populates the path with the directory.  When event 2 fires, it reads the directory and uses it to create the full path, possibly filling in the filename as well.

However, if you can get away with a simple shift register, do it.  It is faster and more efficient than the shift register database.
Message 17 of 18
(1,867 Views)
can u guys tell me what's wrong with my gui. i can't seem to connect the two files (main.vi and data.vi), although they will work individually. if i connect them, the data button won't work (as this is the data.vi), i would then need to force stop the program if i press that button

about the acqusition.vi, am planning to later use it as a subvi to the main.vi file. although it is not yet completed, can i still pass the file path to the acquisition.vi (if by any chance am going to use it as a subvi) from the data.vi?
0 Kudos
Message 18 of 18
(1,838 Views)