Change control values on button press

Hi, I've got a situation where I have several numeric controls where you can change different values. I also have several subVIs with control references (as described in this article: http://labviewwiki.org/Control_References) that takes in references to these numeric controls on the mainVI. These subVIs continously read the values in their own threads.
So whenever I change a value on any of the controls, the values does of course change in the subVIs, since they reference to the value of the control.  How would I make the actual value only change only after I clicked the ok button?
To illustrate this I made a VI with an event structure and a separate while loop that continoulsy reads a reference to the control and updats an indicator. I can think of a few cumbersome solutions, whereas I have two controls for every value. The second control would then be hidden and only written to in case of the Ok button press. But having two controls to do something simple as this seems superfluous.
Message Edited by Siniz on 10-20-2009 10:36 AM
Solved!
Go to Solution.
Attachments:
ValueChangeOnButtonPress.vi ‏19 KB

Given what you want to do then I would suggest that you use an Action Engine to contain your data. This has the advantage of decoupling the UI from the subtasks. I would recommend that your action engine consist of an array of clusters. Each cluster would contain the data values, in your case Ki, Kd and Kp for each controller. This has the advantage of reducing the individual values you are dealing with and treats the data for a given controller as a whole. The subtasks could either poll the data looking for a value change. You could even keep track of that in your Action Engine so you would only need to poll to see if the data changed. If it did, then read the data. You would need an index or ID to specify which controller's data you would want to access. The action engine allows you to grow your application if more controllers are added. You should use a typedef to define the cluster. If you wanted to make this more event driven you could use a single notifier shared by your subtasks that would simply indicate a data change event. Part of the data for the notifier could specify which data. That way only interested subtasks would take action. This type of architecture wouldn't add lots of wires to your diagram especially if you used a named notifier.
Regardless of the way you choose to pass the data to the subtasks I would take a look at your UI. I haven't seen it so I can't comment on it specifically. However is you have 40 controls on the front panel at the same time it most likely is a confusing interface. There are ways to reduce the complexity and still provide the same functionality. If you haven't already looked at I would recommend getting the book The LabVIEW Style Book by Peter Blume. If you did reduce your UI to only work with a single controller or a couple of related controllers at a time the Action Engine approach would work nicely since you take your data from the FP and only update the data that has changed. From a UI perspective you have less controls to worry about on your UI and it will probably be easier for the user to understand. From the application's perspective you have decoupled the subtasks from the UI in a very clean way. Another approach would be to use LVOOP for your controller data and processing. Then you simply instantiate a new instance of the class (an object) for each controller that your system is using. This has an added benefit of allowing you to use different controllers and load them at runtime using dynamic dispatching.
PS You are good for the overall Kudo count. Thanks.
Message Edited by Mark Yedinak on 10-20-2009 12:33 PM
Mark Yedinak
"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot

Similar Messages

  • Timer value between button presses

    Hello all,
    I am trying to simulate a cell phone key pad using Labview. The problem is with text editing. When the number 2 key is pressed, for example, the first key press is number 2, the second key press (within 300 mS) will gives the letter "a" and so on.
    My question is : how do I monitor the elapse time between ke presses.
    I have found this vi from NI Keypad Ver 5.vi. How can I modified this for my purpose.
    Thanks in advance for the help and input.
    Van
    Attachments:
    Keypad_Zip_Files.zip ‏37 KB

    I've modified the example to behave the way that you ask. I added a few shift registers to keep track of elapsed time, number of times pressed, and last button pressed. Take a look at it and see if it makes sense to you, if not let me know and I can provide a more detailed explaination. I saved it to LV version 5 because I wasn't sure what version you were using.
    Hope it helps
    Brian
    Attachments:
    Keypad_Ver_5.vi ‏72 KB
    Keypad.vi ‏83 KB

  • How to set/change spell value after button is pressed

    Hi All,
    I have a requirement, I need to change the spell value(Boolean) dynamically based on the sitution. (say for eg. If i click search spell (ReadOnly) variable shouldbe set to TRUE.like that ..
    I have create a dummy VO and in that VO I have created spell variables.
    Can some one help me how to do this when a button is pressed, I wrote code after buttton pressed it's throwing the below error.
    if(pageContext.getParameter("Create")!=null)
    OAViewObject disvo = (OAViewObject)am.findViewObject("XxafpEepStageRebateValidateVO1");
    OARow row1 = (OARow)disvo.first();
    row1.setAttribute("ItemProperty", Boolean.FALSE);
    row1.setAttribute("ReadOnly", Boolean.TRUE);
    call another page..
    Error(102,6): class OAViewObject not found in class xxafp.oracle.apps.qp.pricelistrebate
    Thanks,
    Mahesh

    Hi Mahesh
    Seems you have not imported OAViewObject Class in your controller..Do the following in the import section of your controller..
    import oracle.apps.fnd.framework.OAViewObject;AJ

  • Make box that changes color depending on button pressed

    I need to be able to press 1 of 6 buttons that change
    graphics to a page on a single-frame site I'm building. This is the
    first time I've built a single frame site (calling swf's) and it
    seems easy but having the green button fade whatever color exists
    down while fading green up and isn't as easy as I thought. In order
    for it to be "smart" and know what color is there so it can fade it
    (probably even easier way than being color specific - but I
    obviously don't know it).
    Just getting into the AS2 part of flash and trying to meet
    deadlines while learning is hard to do, so thanks for the help!

    Hello:
    Say you have a page that has 2 regions R1 and R2. Each region has a button that when clicked submits the page. The buttons are named B1 and B2. Further, F1 and F2 are the first fields in region R1 and R2. There also is a hidden item named H1 on the page (region does not matter). So, you define a pl/sql page process with a process point of 'After Submit...' with the following codeif :request in ('B1') then
       :H1 := 'F1';
    end if;
    if :request in ('B2') then
       :H1 := 'F2';
    end if;The APEX built-in variable named 'REQUEST' is automatically assigned a value of the button that caused the page to submit.
    Varad

  • How can i change control values based on a read-in file?

    I understand that controls only have outputs and indicators only have inputs, but I'm looking for some help creating code that has the capabilities of both. Specifically and ideally, my front panel would allow the user to select an old spreadsheet file to read, and those values from the spreadsheet would be displayed. The user could then tweak those values to their liking, and then submit those tweaked values as a new file/overwrite the old/etc. The important part is the the indicating and controlling of the read in values.
    thanks
    Solved!
    Go to Solution.

    Using a local variable works well if I want to view and change a single value, but I want to view and change a few different values that are to be read in from a speadsheet. I have tried creating an array and then inserting numeric controls into the array, on the front panel. The code will run, but there is no output to the array control. I can't for the life of me pinpoint where the issue is.
    Is inserting multiple numeric controls into the array, not a good idea? Should I just create 3 separate numeric controls and local variables to get around this?
    Message Edited by csmrunman on 09-16-2009 11:48 AM
    Attachments:
    controlasindicator.vi ‏7 KB

  • Drop down list in Table Control - Value disappeared after pressing ENTER

    Dear Gurus,
    I have a problem in one of my development where I used a table control in which one field is a drop down list.
    I used VRM_SET_VALUES and VRM_GET_VALUES for populating the values from the programand not use any domain level value table for that field.
    My problem is when I select one value from this list , and pressing enter , the value get disappeared. But if I use a domain for this field with value table then everything working properly.
    My doubt is am I doing some miss coding or using the VRM_ function modules improperly ?
    I am sharing some code with you
    in PAI :
    CALL FUNCTION 'VRM_GET_VALUES'
        EXPORTING
          id            = 'ITAB-FIELD3'    "This is drop down list element on screen
        IMPORTING
          values        = values[]    " even it is not the expor parameter...it will work..
       EXCEPTIONS
         id_not_found   = 1
         OTHERS         = 2.
      IF sy-subrc NE 0.
      No sy-subrc check required.
      ENDIF.
    IN PBO
    CALL FUNCTION 'VRM_SET_VALUES'
           EXPORTING
                id     = 'IVBAP-ERNAM'
                values = values[].
    Can you please help me.
    Thanks .

    HI,
    The link contains the list box creation, just check if this might help.
    Re: Getting values back from a listbox.
    Regards and Best wishes.

  • Trapping - "Do you want to save changes" alert button pressed

    When exiting a data block with unsaved changes, the user is prompted with "Do you want to save the changes you have made ?" The possible button click responses are "Yes", "No", "Cancel"
    Is there a way to programmatically catch the click on the "Cancel" button ?
    Oracle Forms 10g

    Thanks for the suggestion W1zard. Here is the solution that I have come up based on the recommendation.
    Essentially I create my own custom alert that mimics the system generated alert. In this manner I am able to control the behavior based on the alert button pressed by the user. This method also suppresses the system generated alert, so the user isn't prompted twice.
    At the form level I have created the KEY-EXIT and the KEY-ENTQRY triggers. Additionally I created an ALERT titled SAVE_CHANGES with buttons Yes, No, Cancel.
    h4. KEY-EXIT Trigger
    DECLARE
         alert_id     ALERT;
         alert_button     NUMBER;
    BEGIN
         IF :SYSTEM.FORM_STATUS IN ('CHANGED') THEN
              alert_id := FIND_ALERT('SAVE_CHANGES');
              alert_button := SHOW_ALERT(alert_id);
              -- ALERT_BUTTON1 is Yes, ALERT_BUTTON2 is No, ALERT_BUTTON3 is Cancel
              IF alert_button = ALERT_BUTTON1 THEN
                   EXIT_FORM(DO_COMMIT);
              ElSIF alert_button = ALERT_BUTTON2 THEN
                   EXIT_FORM(NO_COMMIT);
              ELSE
                   RAISE FORM_TRIGGER_FAILURE;
              END IF;
         ELSE
              EXIT_FORM;
         END IF;
    END;h4. KEY-ENTQRY Trigger
    DECLARE
         alert_id     ALERT;
         alert_button     NUMBER;
    BEGIN
         IF :SYSTEM.FORM_STATUS IN ('CHANGED') THEN
              alert_id := FIND_ALERT('SAVE_CHANGES');
              alert_button := SHOW_ALERT(alert_id);
              -- ALERT_BUTTON1 is Yes, ALERT_BUTTON2 is No, ALERT_BUTTON3 is Cancel
              IF alert_button = ALERT_BUTTON1 THEN
                   COMMIT_FORM;
                   ENTER_QUERY;
              ElSIF alert_button = ALERT_BUTTON2 THEN
                   CLEAR_FORM(TO_SAVEPOINT);
                   ENTER_QUERY;
              ELSE
                   RAISE FORM_TRIGGER_FAILURE;
              END IF;
         ELSE
              ENTER_QUERY;
         END IF;
    END;

  • Changing the value of a control in a subvi

    I think the answer is out there somewhere but I've read through many threads found with searches similar to this topic so sorry to repost...
    I would like to change the value of a top-level VI control from a sub-vi.  The data is being used as a parameter, I was thinking about using a local/global but I've seen this discouraged.  Is there a way I can do it with references, property, or invoke nodes (or some other suggested method) ?
    I am guessing that if I am not using globals I will need to wire into the sub-vi?
    Dave

    I'd like to clarify what I am trying to do a bit more...
    The sub-vi has a control of the same type as the top-level vi.  The inital control value is being passed into the sub-vi from the top-level vi.  The sub-vi uses the control value in several places through local variables (reading and writing to it)
    I would like to modify the vi so the top-level vi control value changes whenever the sub-vi changes the control value that is passed to it.
    My last attempt was to make a refnum control in the sub-vi (by dragging from top-level block diagram to sub front panel) and then creating a property node from that refnum control.  Using the property node "value" did not give me the value of the control from the top-level vi as I had hoped.  Wiring it to a terminal that was expecting the same type of control (a cluster of two numerics) caused a wiring conflict.
    I noticed elsewhere in the code that the programmer used a text file to save options (unfortunately the control I am working on was not originially included in the options).  There is a vi that, when called, either reads or writes to the text file.  From a C/C++ programming perspective it seems quite odd to me not to just keep all this data in memory and pass it around.  Is using a file to store variables a typical practice in LV programming (even when they are retrieved multiple times during program execution) ?

  • How to check if a user has clicked on a digital control and changed its value?

    Greetings !!!
    I am looking for a simple way (without using Windows messages)of knowing if an user has clicked on a digital control and changed its value.
    I have tried the key focus property; but I have to click twice to make it work.
    If somebody knows a better solution; please let me know.
    Thank you in advance for your help

    If you just want to know if the value has changed you can put it in a while loop and use shift registers to see if the value has changed.
    Brian
    Attachments:
    Changed.vi ‏22 KB

  • Team Foundation Server 2013 Refresh button not refreshing Custom Control values in TFS Templates

    Hi all,
    We have recently migrated from Team Foundation Server 2010 to Team Foundation Server 2013 Update 2. In TFS 2013 template design we found the refresh form control (inbuilt control of TFS) which is unable to refresh the custom control values that is built
    by us. Is there any way that we can programatically modify to enable the refresh button work with custom control.
    Please find below screenshot link for reference.
    http://postimg.org/image/z4mo3t8r9/
    SaranRam

    Hi SaranRam,
    The refresh button is there to allow the data that populated the work item to be refreshed. The data that you want refreshed is part of the rendering of the form and would only be refreshed when the browser refreshes. Refer to MrHinsh's reply in this
    page.
    Best regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to change the value from one input control to another input control?

    Hi Experts,
    I want to change the value from  one input control to another input control. For Example if i change month in first tab. it should reflect in second tab also. How should we acheive through input control or some other option.
    Here I attached screen shot.Please help me for this

    Hi,
    It is not possible to have Input controll in all tabs that will be set from another .
    But There is one workaround .
    Follow the link below .
    http://davidlai101.com/blog/2013/08/13/web-intelligence-input-control-that-affects-all-tabs/

  • Change the value of a SharePoint List lookup control value using javascript

    hi,
    could you please help in changing the value of a SharePoint List lookup control value using javascript.
    Please note that i have to change the lookup value which is in the form of a drop down from the infopath form.
    Thanks

    https://stackoverflow.com/questions/5678210/select-dropdown-menu-option-with-javascript
    Does that help?

  • Changing default control values in LV application?

    Can anyone help me?
    Is it possible to change default control values in LV program
    programmatically?
    Sergey Yakovlev, Berlin,
    [email protected]

    Its quite complex (in my opinion) to do so programically , but using a set of invoke nodes, you can get it done ('Make this value default'). Look at the attached for info (its a large link name, so you may have to copy and paste in your browser).
    http://zone.ni.com/devzone/devzoneweb.nsf/opendoc?openagent&2C14132F826F839F8625683A000B0B99&cat=DB5863CD70417B07862567930070A058
    I've been simply using config.txt files of read and write to set values.

  • HT1918 ive changed my account details and pressed the done button the phone and also in i tunes keeps telling me to contact I tunes support ??

    ive changed my account details and pressed the done button the phone and also in i tunes keeps telling me to contact I tunes support ??

    Click here and ask the iTunes Store staff for assistance.
    (104672)

  • Event handling while changing the value or clicking the button

    Hi All,
    I am working on Jdeveloper 11.1.1.5.
    I have a must requirement where i have a textbox and a button.
    Now if a user changes the value of the textbox then i need to show a dialog to the user for the confirmation that whether he wants to continue or not.
    And on click of button i execute my business logic and commit in the database.
    NOTE :- I am opening that dialog on the valueChangeEvent of the textbox.
    Case 1 :-
    User enter a value in the textbox and tab out the field , value change occurs and dialog displayed onto the page. -> CORRECT
    Case 2 :-
    User enter a value in the textbox and does not tab out the field and directly click on the button.In that case , actually valueChange and button code both executes at the same time.I mean to say , the user click on the button , i get the dialog , but my business logic also gets executed. -> INCORRECT(ISSUE)
    How should i restrict the button logic to be executed till the dialog has been shown and user has confirmed.
    Kindly suggest!!!
    Regards,
    Shah

    Hi Shah,
    You can try something like this:
    <af:inputText autoSubmit="true" id="it1" ...>
      <af:setPropertyListener from="true" to="#{viewScope.uncommittedData}" type="valueChange"/>
    </af:inputText>
    <af:commandButton partialTriggers="it1" disabled="#{viewScope.uncommittedData ne 'true'}" .../>AP

Maybe you are looking for