Asking a user for input trouble
Hi,
Im writing something where I need the user to input the width and height of a certain object and then output the area. I will use that area for later calculations.
The problem I am having is its continuously running every time, I only want it to run if the fields are left blank or the area is equal to zero.
Any suggestions on what I should do?
I am using labview 8.20
Thanks
-D
Darren870 wrote:
The problem I am having is its continuously running every time, I only want it to run if the fields are left blank or the area is equal to zero.
What kind of controls are you using for the inputs? Logical would be numeric controls (not e.g. strings).
Use an event structure inside a while loop, triggerend by a value change in the two inputs and recalculate the area whenever one of the inputs changes. (it is probably cheaper to always calculate the area, even if one or both of the inputs are zero. You will simply get an area of zero, which is a correct result.
A normal program never uses the "continuously run" button. If you want the program to stop after the area is no longer zero, do the above and wire the area result to the loop termination via a "not equal zero" node. Typically you would not do that, but instead keep it running as long as you need to calculate areas.
LabVIEW Champion . Do more with less code and in less time .
Similar Messages
-
HOW DO I CHANGE THE FONT OF "Message to Display" IN THE Prompt User for Input
Hi,
HOW DO I CHANGE THE FONT OF "Message to Display" IN THE Prompt User for Input?
Thanks for your help
XNRight click and select Open front panel >> Convert.
Change the vi as you need. then you can save it as a normal sub-vi.
If you have Labview 8.6, maybe (i am not sure) you can edit the express vi. Express vis are supported in 8.6 -
Limit checkboxes on "prompt user for input"
Is there away to limit the selection of checkboxes on the "Prompt User for Input" dialog vi? I am trying to build a dialog vi that will allow the user to select/check only 1 item before clicking OK.
Attached is my VI. This VI takes a entered filename and check to see if it exists in a given directory. If it does not exist, then it created (display a message stating it will be created). If the file does exist, then the user has prompted to select 1 of 4 options (Append, Replace (Overwrite), Re-Name (select new filename) or Escape (exit without creating filename). Right now I am using front panel controls that become visible however I would like to replace these controls with a dialog box with the four options.
Ideally this file selection would be a sub VI in application and only execute when called and only be visible via the dialog boxes.
Thank you.
Attachments:
FileChoices.vi 210 KBLike radio buttons? See
http://digital.ni.com/public.nsf/3efedde4322fef19862567740067f3cc/373f703eea0297368625620900701fd8?O...
Message Edited by Phillip Brooks on 10-16-2006 02:46 PM
Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.
"You are what you don't automate"
Inplaceness is synonymous with insidiousness -
Need help with re-prompting the user for input .
I am trying to wright a code the re prompts the user for input if they enter anything but an integer but I keep getting a "char cannot be dereferenced" error when I try to compile.
Here's what I have got:
import java.util.Scanner; // imports Scanner methods
public class SandBox
public static void main(String[] args)
// re-prompting test
Scanner in = new Scanner(System.in);
System.out.println("Please enter an integer: ");
String i = in.nextLine();
for(int a=0; a<i.length(); a++)
if( (i.charAt(a).isDigit()) ) {
System.out.println("Thank you!");
break;
} else {
System.out.println("Please try again");
continue;
int b = Interger.parseInt(i);
}// end of class
}//end of main method
Sorry for double posting but it won't let edit my last post.
I would prefer to go through it without using try catch because it takes longer though I will use it if I cannot get the other way working. I currently have two versions of the code both using try catch and the other way but both say that they "cannot find symbol" when I try to parse. here are both versions of the code:
import java.util.Scanner; // imports Scanner methods
public class SandBox
public static void main(String[] args)
// try catch test
boolean inputIsFaulty = true;
int inputInt = 0;
Scanner in = new Scanner(System.in);
do {
System.out.println("Please enter an integer: ");
String i = in.nextLine();
for(int a=0; a<i.length(); a++)
if (Character.isDigit(i.charAt(a))) {
System.out.println("Thank you!");
inputIsFaulty = false;
} else {
System.out.println("Please try again");
while (inputIsFaulty);
inputInt = Integer.parseInt(i);
}//end of class
}//end of main method
import java.util.Scanner; // imports Scanner methods
public class SandBox2
public static void main(String[] args)
// try catch test
boolean inputNotOK = true;
int inputInt = 0;
Scanner in = new Scanner(System.in);
do {
System.out.print("Please enter an integer: ");
String inputStr = in.nextLine();
try {
inputInt = Integer.parseInt(inputStr);
// this line is only reached if the parse works
inputNotOK = false;
catch (NumberFormatException e) {
System.out.println("You didn't enter a proper number. Please Try again.");
while (inputNotOK);
inputInt = Integer.parseInt(imputStr);
}//end of class
}//end of main method
-
Modifying "Prompt user for input"
Hi, all.
Is there any "Prompt user for input" VI where I can include enum or ring type inputs? If not, how can I modify the "Prompt user for input" VI to do that?
Thanks,
Francisco
Solved!
Go to Solution.Right click on the express VI and select 'Open Front Panel'. This will convert it to a regular VI that you can edit. Or, just create your own VI from scratch. Look at the shipping examples for 'pop-up's.
-
ExpressVI prompt user for Input dialog floating
I am using ExpressVI "prompt user for Input". The question is, when the dialog window pops up for input, I cannot activate other windows .
So how can I change this expressVI's dialog window to floating windows appearance?Short answer: you have to make your own.
You can start with the Express VI by right-clicking on the express VI and selecting "Open Front Panel" and click "Convert". This will create a brand new VI that is the equivalent of the Express VI. Save the VI under a new name within your project hierearchy, and then change the properties on the VI from a modal to a floating:
Select File->VI Properties.
Select "Window Appearance" from the pulldown menu.
Select "Custom" option and click "Customize...".
Select "Floating" in the "Window Behavior" section. -
How to get default input values when using promt user for input
I use "promt user for input" to input some values. The messageboard appears with blank boxes then I will input new values. I want to make some default values in this blank boxes so that I needn't to enter new values. Is it possible ?
Right click on he Express Vi terminal and choose open Front panel to convert it into a standard vi. Then open it. Enter a default value for each control, then right-click on the controls and go to data operation > make current value default.
Message Edité par chilly charly le 11-18-2007 12:52 PM
Chilly Charly (aka CC)
E-List Master - Kudos glutton - Press the yellow button on the left... -
Is it possible to let the SecurityManager ask the user for permissions?
Hi there!
I would like to write an applet which should realize single-sigon via JAAS and for jaas I need some access to the underlaying os which is permitted by the security manager.
I dont want to buy a certificate or to go through all our (700) Computers and install my self-made certificates and change the policy file.
So is there a way to let java ask the user if it trusts the applet (may with remeber this desision) to e.g. let it access features needed for jaas.
This way can be direct (via api call) or not (applet signed via free long valid (at least 5 years) certificate), however the only important thing is that I get access to the system.
Any ideas, I would be happy about (nearly g) everything ;-)
Thanks a lot, lg ClemensHowever thanks a lot for help g
Found the answer myself: Simply sign the applet with an self-made certificate, the next time the browser is restartet there will be a promt for acceptimg the certificate.
Cool! -
I have the code to read from a file but my problem is how to prompt the user for the file name at run time.
import java.io.File;
import java.io.FileNotFoundException;
import java.util.InputMismatchException;
import java.util.Scanner;
public class FileRead {
public static void main(String args[]) {
Scanner scan = null;
File file = new File("Results.txt");
String number;
try {
scan = new Scanner(file);
while (scan.hasNext()){
number = scan.next();
System.out.println(number);}
catch (FileNotFoundException ex1){
System.out.println("No such file");
catch (IllegalStateException ex2){
System.out.println("Did you close the read by mistake");
catch (InputMismatchException ex){
System.out.println("File structure incorrect");
finally{
scan.close();}
}Any hints would be greatly appreciated. Thank you in advanceI have read through some of the tutorials that you have directed me too and they are very useful, thank you. however there are still a few things that i am not clear about. I am using net beans 5.0 I have placed a text file named Results.txt into the project at the root so the program can view it.
When I use the code that you provided me with, does it matter where the file is, or will it look through everywhere on the hard drive to find a match?
This code compiles but at run time it comes up with this error
run-single:
java.lang.NoClassDefFoundError: NamedFile
Exception in thread "main"
Java Result: 1
BUILD SUCCESSFUL (total time: 3 seconds)
import java.util.Scanner;
import java.io.*;
class NamedFileInput
public static void main (String[] args) throws IOException
int num, square;
// this Scanner is used to read what the user enters
Scanner user = new Scanner( System.in );
String fileName;
System.out.print("File Name: ");
fileName = user.nextLine().trim();
File file = new File( fileName ); // create a File object
// this Scanner is used to read from the file
Scanner scan = new Scanner( file );
while( scan.hasNextInt() ) // is there more data to process?
num = scan.nextInt();
square = num * num ;
System.out.println("The square of " + num + " is " + square);
}his is the code that i used. It is the same as the code you posted for me (on chapter 23 I/O using Scanner and PrintStream) Sorry im just really stuck on this!! -
Ask user for input after Workflow has already started?
I am in the process of creating an "expense report" declarative workflow in Designer. I want to have it start automatically when a new document (here, an Excel file) is uploaded to the Library. I also want some user input (e.g. "Is this
ER urgent?"). Is there a way to this without requiring the workflow to start manually?You can have required information as metadata on your library and user needs to fill those information. You read that information in your workflow.
Amit -
Prompt user for input when rdp with same user as logged in
What I am trying to achieve: user dragos is logged in on a domain computer. When I connect with rdp with the username dragos on the computer I want user dragos to be asked if he allows the connection or not not to be taken over.
When you connect as different user it is being asked, but not when connecting as same user as logged in.
Searching for solutions I found this: Administrative Templates\Windows components\Remote desktop services\Remote desktop session host\Connections\Set rules for remote control of Remote Desktop Services user sessions and give it Full control with user
permission.
But it does not work as I was expecting.
Is there a solution for the logged in user to be promped if connecting with the same user name ?
Thank youHi,
user dragos is logged in on a domain computer. When I connect with rdp with the username dragos on the computer I want user dragos to be asked if he allows the connection or not not to be taken over.
As far as I know, there is no built-in method to achieve this.
You may try to search whether there any third-party tools which can achieve this, or write a script.
If you need assistance with scripting, here are some scripting forum links below for you:
The Official Scripting Guys Forum
http://social.technet.microsoft.com/Forums/scriptcenter/en-US/home?forum=ITCG
Windows PowerShell Forum
https://social.technet.microsoft.com/Forums/en-US/home?forum=winserverpowershell&filter=alltypes&sort=lastpostdesc
MSDN Forums
https://social.msdn.microsoft.com/Forums/en-US/home
Best Regards,
Amy
Please remember to mark the replies as answers if they help and un-mark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected] -
Prompting user for input for each row in the report
Is it possible to have a user entered field for each row in a report ?
ie. have a report with empolyee number, employee name, title, salary, and comment. Select of of these columns from the SQL query except for the comment, and then when the report is generated have the user be prompted for what the want the comment to be for every employee in the report?That is, have the user generating the report enter in a different comment for EACH employee. (ie Joe Smith's comment is "good worker and John Smith's comment is "come to work late on Tuesdays and Thursdays", Sally Jones' comment is "Expert in C++" etc.) as the reports is being built for each row returned from the query.
-
"printf" asking for input data
Hi, my cuestion is why when I ask the user to input data in the test bench with "printf" for my TOP.c not run?
NOTE: I am a new user HLS :)
Regards
welcome
Also besides Gabor's answer, please note that the testbench execution is wrapped into other scripts, so user input would not work because it's not interactive (if i remember correctly) so you can't do cin , gets , scanf etc
From the GUI, when performing csim there is the ability to enter input arguments to the executable - ie the ones passed to argv.
If you want to do user interactions, then you need to go to a command line and navigate to YOURPROJ/YUORSOLUTION/csim/build and run the executatble from there : it's call csim.exe.
As such I would recommend to avoid using user inputs in your testbenchs - but you can use loops or text files with 1000s of test values.
I hope this helps. -
Best way to ask user for duration ??
I am wondering what the best way to set up a dialog to ask the user for a duration is ?
I need to query the user for the following duration example 1 month 3 days 5 hours 15 mins
I have tried messing around with JSpinners with date formats but they really only work with fixed calendar dates not calendar durations...
Any ideas on a neat approach..
Currently i have an individual number spinner for each of the items which looks ugly and is hard to manage as you have to take care of up to 23 hours but 24 is one day so one day etc etc..
Thanks in advance
-AlanYou continue along the same lines; keep the DTO in the session as an attribute. When you display your JSP, read the appropriate values for choices from the DTO and set your checkboxes/ radio buttons to 'selected' if they should be.
When the page is submitted, read the parameters from the form submit and update your session attribute ( DTO ) to reflect any changes the user might have made like selecting a new option or deselecting a previously selected one.
People on the forum help others voluntarily, it's not their job.
Help them help you.
Learn how to ask questions first: http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch
(Yes I know it's on JavaRanch but I think it applies everywhere)
---------------------------------------------------------------- -
Asking user for value to resize?
Hello guys. I want to make a quick script that will take the selected finder item, ask the user for a value to resize (In the form of a dialog box) and then using that percentage, execute the scale image function under preview. Does anyone know how I could do this? Thanks!
Get Selected Finder Items
Scale Image (Preview Library, check the "show when run" option)
As written here, this works on the original. Put a Copy Finder items in Place of Get Selected Finder items if you want to work on a copy.
Kevin
Maybe you are looking for
-
I updated to latest version of iTunes and it isn't working. What do I do?
I downloaded iTunes update 12.0.1 to my Windows 8 computer, and it did not open when I finished. It gave an error message that it cannot find iTunes. I tried uninstalling and reinstalling iTunes 2 or 3 times. I'm afraid I lost all my music. It st
-
EDI validation Error: Segment GS(Functional Group Header) at guideline
Hi, I am working on EDI 272 transaction(inbound). I created ECS file for EDI 272 and validated the EDI 272 data with ECS file in the B2B document editor. Validation was sucess in the B2B document editor when I upload the same ECS file and tested the
-
How to give "SubclassInformation" property for item
Hi, How to give "SubclassInformation" property value for an item.Please help me to resolve this problem.Thanks in advance. Regards, Tharini.
-
Sales Deal with two different validation dates for the same material
Hi SAPers, I am trying to create a u201CSales Dealu201D VB31, for the same material/condition, but with two different validation dates. After the creation of the first record, I select u201CNew conditionu201D button, but the system give me the messag
-
How can i know the answers of my security questions ?
can someone please help me