Problem with drawing chart in event driven programming and XControl

Dear my friends
I have a xcontrol, that has two buttom and a chart. i want to do this:
1- when i press the "start" button chart starts to add random numbers
2- when I press the "stop" button the start should stop drawing random numbers.
 I mean after pressing the start the chart should add points until I press the stop button.
also I add "start button value change"  event case and i put the code inside that event.
but when i press the start the chart adds one point.
using while loop inside a event case is not good for adding extra points.
can someone help me how to do this?
I oppologize due to my weak english.....

An Xcontrol immediately returns after each Read or write. It should not stall the calling VI. It is not something that should run for extended periods. You can use a plain reentrant subVI, for example.
If you want to learn about Xcontrols, have a look at the dual mode thermometer (or similar) that is included with the example finder.
LabVIEW Champion . Do more with less code and in less time .

Similar Messages

  • Periodic reading data with event driven programming

    Hi all
    I want to read data from a device periodically, for example every 2 seconds.
    but I want to use event driven programming in order to response user events.
    now I don't know how to do this......!!
    maybe I should use timed loop or timed sequence structure
    if I use this structures, should I use then inside the while loop or outside the while loop( I mean the while loop that contains the event cases)?
    please help me and accept my thanks....

    You ned to run these in two separate loops. Look at the Producer/Consumer template. Put a two second time-out on the Dequeue Element and you have a loop that will run every two seconds. The loop should also handle information from the event structure.
    Separate loops is the best way of handling this.
    Rob

  • Event-Driven Programming

    Hello Everyone,
    I am new to this forum and also new to event-driven programming. Anyways, I am doing a small exercise to get myself familiar with event-driven programming. In particular, the program responds to keys entered on a keyboard. The exercise in a way resembles how a second hand moves in a clock. So, here's what I am trying to do. Originally the hand points at 12 o'clock. when I press the right arrow key the hand should move 6 degrees to the right and when I press the left arrow key the hand should move 6 degrees to the left. The code I have so far seems fairly correct to me but when I run the program and press the arrow keys on my keyboard nothing happens. Any help would be appreciated and thank you in advance.
    Here is my code:
    import java.awt.*;
    import java.util.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class hittingBalloons extends JFrame{
         hittingBalloons(){
              mouseKeyboardListeners p = new mouseKeyboardListeners();
              add(p);
              p.setFocusable(true);
         public static void main(String[] args){
              hittingBalloons frame = new hittingBalloons();
              frame.setTitle("Hitting Balloons");
              frame.setSize(500,500);
              frame.setLocationRelativeTo(null);
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.setVisible(true);
         public class mouseKeyboardListeners extends JPanel{
              private int xCenter=250;
              private int yCenter=250;
              private int xEnd =250;
              private int yEnd =210;
              private int angle=0;
              private int gunLength=40;
              private int xBall = 150;
              private int yBall = 150;
              private int radius = 20;
              public mouseKeyboardListeners(){
                   addKeyListener(new KeyAdapter(){
                        public void keyPressed(KeyEvent e){
                             if(e.getKeyCode() == KeyEvent.VK_LEFT){
                                  angle = (int)(angle - (Math.PI/30));
                                  xEnd = (int)(xCenter + gunLength*Math.sin(angle));
                                  yEnd = (int)(yCenter - gunLength*Math.cos(angle));
                                  repaint();
                             else if (e.getKeyCode() == KeyEvent.VK_RIGHT){
                                  angle = (int)(angle + (Math.PI/30));
                                  xEnd = (int)(xCenter + gunLength*Math.sin(angle));
                                  yEnd = (int)(yCenter - gunLength*Math.cos(angle));
                                  repaint();
              protected void paintComponent(Graphics g){
                   super.paintComponent(g);
                   g.drawLine(xCenter,yCenter,xEnd,yEnd);
    }

    A few notes and suggestions:
    1) Welcome to the forum!
    2) When posting code, please use code tags as it makes your code easier to read. the FAQ will show you how. e.g.,
    import java.awt.*;
    import java.util.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class hittingBalloons extends JFrame{
         hittingBalloons(){
              mouseKeyboardListeners p = new mouseKeyboardListeners();
              add(p);
              p.setFocusable(true);
         public static void main(String[] args){
              hittingBalloons frame = new hittingBalloons();
              frame.setTitle("Hitting Balloons");
              frame.setSize(500,500);
              frame.setLocationRelativeTo(null);
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.setVisible(true);
         public class mouseKeyboardListeners extends JPanel{
              private int xCenter=250;
              private int yCenter=250;
              private int xEnd =250;
              private int yEnd =210;
              private int angle=0;
              private int gunLength=40;
              private int xBall = 150;
              private int yBall = 150;
              private int radius = 20;
              public  mouseKeyboardListeners(){
                   addKeyListener(new KeyAdapter(){
                        public void keyPressed(KeyEvent e){
                             if(e.getKeyCode() == KeyEvent.VK_LEFT){
                                  angle = (int)(angle - (Math.PI/30));
                                  xEnd = (int)(xCenter + gunLength*Math.sin(angle));
                                  yEnd = (int)(yCenter - gunLength*Math.cos(angle));
                                  repaint();
                             else if (e.getKeyCode() == KeyEvent.VK_RIGHT){
                                  angle = (int)(angle + (Math.PI/30));
                                  xEnd = (int)(xCenter + gunLength*Math.sin(angle));
                                  yEnd = (int)(yCenter - gunLength*Math.cos(angle));
                                  repaint();
              protected void paintComponent(Graphics g){
                   super.paintComponent(g);
                   g.drawLine(xCenter,yCenter,xEnd,yEnd);
    }3) For key listeners to work, the component must have the focus, and JPanels don't get focus by default. You have to call setFocusable(true) first and then request focus in window on the JPanel.
    4) Even better would be to use key binding, and to learn to use these, check out the Sun tutorial.
    Luck and again, welcome!

  • I have a problem with a chart refreshing after its bound data provider changes.

    I have a problem with a chart refreshing after its bound data
    provider changes. After the subsetHighLowData.refresh() is called I
    would expect the chart to redraw, but it still looks the same. I
    even inspected the debugger to see if the slice had taken place and
    it had.
    Any ideas coding friends?

    "nikos101" <[email protected]> wrote in
    message
    news:gib6aa$prr$[email protected]..
    >I have a problem with a chart refreshing after its bound
    data provider
    >changes.
    > After the subsetHighLowData.refresh() is called I would
    expect the chart
    > to
    > redraw, but it still looks the same. I even inspected
    the debugger to see
    > if
    > the slice had taken place and it had.
    >
    > Any ideas coding friends?
    >
    > subsetHighLowData.source =
    >
    highLowData.source.slice(slider.values[0],slider.values[1]);
    Just use the ArrayCollection's removeItemAt, and it should
    handle the event
    dispatching for you.
    HTH;
    Amy

  • Event Driven Programming is withheld from LabVIEW Base.

    Can anyone give me a good answer why?  Every other programming language in the world has Event Driven Programming (EDP) built in, even free languages.  So when all I wanted was to use LV as a graphical programming language, (hey, that's what the "G" in G-programming stands for) I was disappointed to find that in my undervalued LV Base I can't look for mouse movement, mouse enter, mouse leave, keyboard actions and countless other possibilities that would be standard fare in any other language, unless, I pay over 1200 dollars more for the Full development package.  I know I should have read up on it more before purchasing, and understood what I would be missing out on.  But how was I to know that the fundamental programming function of EDP would be considered on par with Data Acquisition and Signal Processing?  So basically in order to get a complete programming language, I need to spend more than twice the cost of the Base package just to receive the last key component.  And all this because the Evaluation of LV gives you near limitless possibilities, so a new LV programmer gets used to having these tools at his/her disposal, only to yank some of the most critical tools.  So after saying all this, I am pleading for an explanation.  Why isn't there at least some add-on module that would allow a user to install the withheld functionality of EDP to a Base Development package?  Surely making money is the goal of any business, and I won't claim bait and switch here, or any other wrong doing here.  But there is, in my opinion, a marketing misjudgment here.
    -Orion Williams

    Unfortunately to upgrade, it would cost me the difference between the base version and the full version.  What I think is in order is an add-on module that will give customers the functionality of EDP, without having to also pay for signal processing, which is clearly a more robust programming tool, that I don't need.  I am hoping to show NI that by withholding EDP from the base version with no upgrade option except paying for the full version, that their customers who come into LV at the base version are getting an undervalued version, and they know it, and that without at the very least, and add-on module for EDP, isolating smaller business and individuals.  I agree that signal processing, data acquisition and EDP are worth an extra 1300 dollars, but I don't agree that EDP on it's own is worth an extra 1300 dollars, but that's the only option that I have at this moment.  My suggestion is to create an add-on module that includes EDP and sell it for 300 dollars, since I know signal processing is a much more complex feature and is worth more of that upgrade price than EDP.  Of course all versions of LV should include EDP, so if that drives the price of LV base up, so be it.  Just don't let anyone else be fooled into thinking they are buying a Graphical Programming Language unless all the features of a programming language are included at all price points.  Can I get a witness?

  • Regarding Pages charts, when I try to 'build' a 3D chart all I get is little dots but not graphics.  No problems with 2D charts though. Guess my question is "Help?"

    Regarding Pages charts, when I try to 'build' a 3D chart all I get is little dots but not graphics.  No problems with 2D charts though. Guess my question is "Help?"

    Sorry for the delay getting back to this.
    Thanks to Fruhulda and Peter for their comments regarding the refusal of Pages to let me make 3D charts. 
    In answer to the questions put to  me in this regard :
    1. Pages version : Pages '09  v.4.1 (923)
    2. Mac O/S :          v.10.6.8 
    3. 3D chart :          Can't find a 'name', but upright bars with rounded corners ???
    4. Moved apps :    Not that I'm aware of!  All should be as installed off the disc.
    5. A note :              I have been able to create these in the past - related to a SW update? 
                          and ... can create these charts perfectly in Keynote (go figure).
    Thanks to all.
    CM

  • Has anybody had the following error while trying to download iTunes 10.5? There is a problem with Windows Installer package. A program required for this install to complete could not be run.

    Has anybody had the following error while trying to download iTunes 10.5? There is a problem with Windows Installer package. A program required for this install to complete could not be run.

    Go to "control panel" then "add or remove programs".  Highlight "Apple software update"  Choose "change" click "Repair"  This should do the trick.  Then download and install iTunes 10.5 again.

  • Tried to install iTunes 10.5 this morning but an error appeared saying "problem with windows installer package. A program required for this install to complete could not be run." Can someone please help

    I tried to install iTunes 10.5 this morning but an error appeared saying "problem with windows installer package. A program required for this install to complete could not be run." Can someone please help

    Firstly, are you installing iTunes for the first time or are you updating your current version of iTunes?
    If you're installing iTunes for the first time have you tried redownloading the installer package? Perhaps the file you downloaded originally is corrupted...
    http://www.apple.com/itunes/
    If you've tried that, then try installing iTunes as your computer's administrator. To do this right-click the install package and choose "Run as administrator".
    If you're updating iTunes to the most recent version try repairing the Apple Software Update program on your computer. It's under the add/remove programs.
    1. Open the control panel
    2. Open Add/Remove programs (called "Programs and Features" in Windows 7)
    3. Navigate to "Apple Software Update" in the list and click on it
    4. Click on "Change" then select "Repair" (or just select the repair option in Windows 7)
    Once you repair this, try running iTunes and the update again.
    Fingers crossed!

  • I keep getting an error message that reads: There is a problems with this windows installer package A program required for this install to complete could not be run. Contact your support personnel or package vendor. How do I correct this problem.

    I keep getting an error message that reads: There is a problems with this windows installer package A program required for this install to complete could not be run. Contact your support personnel or package vendor. How do I correct this problem. HELP !!!!!!!!!!!!!!

    Try the following user tip:
    "There is a problem with this Windows Installer package ..." error messages when installing iTunes for Windows

  • Trying to down load Itunes but I get a message : There is a problem with this Windows Installer package a program run as part of the setup did not finish as expected. Contact your support personnel or package vendor.

    When downloading Itunes I get this message:
    There is a problem with this Windows Installer package a Program run as part of the setup did not finish as expected.
    Contact your support personnel or package vendor..
    is there a number for me to call or can someone explain what has happen...
    Thank you for your help....

    Try the following user tip:
    "There is a problem with this Windows Installer package ..." error messages when installing iTunes for Windows

  • I went to update my itunes and I get the following message:  there is a problem with this windows installer package, a program required for this install to complete could not be run.  I uninstalled the old itune and reinstalled the new one and i get the s

    I went to upgrade itunes and when it finally downloaded, i got the following message:  There is a problem with this windows installer. A program required for this install to complete could not be run.
    I was advised to unistall the old itune, which i did and then loaded the latest itune 10.5 i think.  It dowloaded fine to a point and before finishing, it came up with the same message.
    Is the problem with the itune installer or my windows installer on my laptop?

    Repair your Apple software update.
    Go to START/ALL PROGRAMS/Apple Software Update. If it offers you a newer version of Apple Software Update, do it but Deselect any other software offered at the same time. Once done, try another iTunes install
    If you don't find ASU, go to Control Panel:
    START/CONTROL PANEL/Programs n Features/highlight ASU and click REPAIR,

  • Downloaded the latest itunes and when i go to install it i get a message saying there is a problem with this windows installer package a program required for the install to complete could not be run, contact your support personnal or package vendor

    When `ve downloaded the latest itunes and then i go to install it i get a message saying there is a problem with this windows installer package a program required for the install to complete could not be run, contact your support personnal or package vendor any ideas anyone ? thanks

    Try the following user tip:
    "There is a problem with this Windows Installer package ..." error messages when installing iTunes for Windows

  • Problem with Area  Chart

    Hi EveryOne,
    Me having problem with area chart,i have taken 3 area series
    to plot when me plotting the values one of the series is getting
    overlapped,Why its happening like this? Me attached the code
    Thanks in advance.
    <?xml version="1.0"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml">
    <mx:Script><![CDATA[
    import mx.collections.ArrayCollection;
    [Bindable]
    public var expenses:ArrayCollection = new ArrayCollection([
    {Month:"Jan", Profit:0, Expenses:0, Amount:450},
    {Month:"Feb", Profit:5, Expenses:0, Amount:600},
    {Month:"Mar", Profit:5, Expenses:5, Amount:300},
    {Month:"Mar", Profit:0, Expenses:5, Amount:300}
    public var expenses1:ArrayCollection = new ArrayCollection([
    {Month:"Jan", Profit:0, Expenses:5, Amount:450},
    {Month:"Feb", Profit:5, Expenses:5, Amount:600},
    {Month:"Mar", Profit:5, Expenses:10, Amount:300},
    {Month:"Mar", Profit:0, Expenses:10, Amount:300}
    public var expenses2:ArrayCollection = new ArrayCollection([
    {Month:"Jan", Profit:5, Expenses:0, Amount:450},
    {Month:"Feb", Profit:10, Expenses:0, Amount:600},
    {Month:"Mar", Profit:10, Expenses:6, Amount:300},
    {Month:"Mar", Profit:5, Expenses:6, Amount:300}
    ]]></mx:Script>
    <mx:AreaChart id="myChart"
    showDataTips="true">
    <mx:series>
    <mx:AreaSeries id="ara" dataProvider="{expenses}"
    xField="Expenses"
    yField="Profit"
    />
    <mx:AreaSeries id="ara1" dataProvider="{expenses1}"
    xField="Expenses"
    yField="Profit"
    />
    <mx:AreaSeries id="ara2" dataProvider="{expenses2}"
    xField="Expenses"
    yField="Profit"
    />
    </mx:series>
    </mx:AreaChart>
    </mx:Application>

    Seems to simply be a problem with your data. See this
    code.

  • HT1349 Hi all,I have just purchased new iphone but have difficulty in completing the itunes download with message : problem with Windows installer package. A program run as part of the setup did not finish as expected.

    Hi all,I have just purchased new iphone but have difficulty in completing the itunes download with message : problem with Windows installer package. A program run as part of the setup did not finish as expected.
    Would appreciate help...its driving me up the wall!!

    Perhaps let's first try updating your Apple Software Update.
    Launch Apple Software Update ("Start > All Programs > Apple Software Update"). Does it launch and offer you a newer version of Apple Software Update? If so, choose to install just that update to Apple Software Update. (Deselect any other software offered at the same time.)
    If the ASU update goes through okay, try another iTunes install. Does it go through without the errors this time?

  • Having trouble trying to install itunes 10.5. Receive message saying 'There is a problem with this installer package. A program required for this install to complete could not be found. Please contact product vendor'

    Having trouble trying to install itunes 10.5. Receive message saying 'There is a problem with this installer package. A program required for this install to complete could not be found. Please contact product vendor'

    Managed to get the installation sorted. Go to Control Panel, and where you have a list of all installed programs, repair all the Apple/Itunes related programs. Installation worked fine after that. Hopefully it helps you out too!

Maybe you are looking for

  • Problem with new version 4.3.2 apps not working " after update to the new version "

    Problem with new version 4.3.2 apps not working " after update to the new version " i was in 4.3.1 then i do the update , but now after update i face this problem , so what i Supposed to do ?!!

  • Upgrade causes constant reboot

    Has anyone else had their iPhone go into a constant reboot cycle after the OS upgrade? I've been watching the Apple logo flash on/off for the past hour. Hard reset doesn't work. Any ideas of how to get it to boot?

  • Decode from other table?

    how can i decode a column value from another table? e.g. the view selects an ID from TABLE1 and wants to add a column "Description" that decodes the value of the ID column. The decode() function is usable for a small set of fixed decodings. But what

  • You speak spanish ?? i need help with my accourt

    you speak spanish ?? i need help with my accourt

  • Apple Mail font  and colour changes while typing!

    I'm having an issue whereby the font and colour changes back to the default while I'm typing an email! I have several signatures.  When I select a signature and start typing, at apparently random moments, the font reverts to the default! This will ha